Fetchmail with local Postfix on Home-Server

6,377

Solution 1

Fixed with this.

poll pop.1and1.com
  protocol POP3
  envelope "Delivered-To:"
  localdomains example.org
  user "*@example.org" there
  with password "Passw0rd!"
  is * here
  smtpaddress localhost
  ssl
  fetchall

Then the postfix receive all mails and handles the correct mailbox. (Its funny: You can redirect fetched mails to internet :D :D)

But thanks @Lambert for your Idea. I read about mda and dont know if it's usefull and the "is local-user here" not worked, too.

Solution 2

You can instruct fetchmail which is the remote user and which is the local user by:

poll pop.1and1.com protocol POP3:
    user "[email protected]" there with password "Passw0rd!" ssl fetchall
    is local-user here

It is also possible to use another mda using:

poll pop.1and1.com protocol POP3:
    user "[email protected]" there with password "Passw0rd!" ssl fetchall
    is local-user here and wants mda /path/to/mda
Share:
6,377

Related videos on Youtube

Sara Deh
Author by

Sara Deh

Updated on September 18, 2022

Comments

  • Sara Deh
    Sara Deh over 1 year

    a small question... I have a fully configured postfix server which have a few domains, few users, and much more.

    Then I have a smart host which receives all mails and send all mails. For example 1and1.com or some hoster like that.

    The HomeServer postfix has this hosting as SmartHost (= RelayHost) configured. So that all outgoing mails would be send via this hosting.

    For incoming mails I have a external POP3 account for this hosting. It's like [email protected].

    Via fetchmail I want to retrieve all mails from the catch all and deliver VIA POSTFIX to local users. (Or maybe with dovecot directly!?)

    So the POP3 account contains a mail like: "FROM: [email protected]\n RCPT TO: [email protected]"

    The fetchmail should retrieve this mail and "send"/forward/save the mail in the inbox of user with mail address "[email protected]".

    Configuration of fetchmail:

    set daemon        300                # Pool every 5 minutes
    set syslog                        # log through syslog facility
    set postmaster  root
    
    set no bouncemail                # avoid loss on 4xx errors
    defaults:
    timeout 300
    antispam -1
    batchlimit 100
    
    poll pop.1and1.com protocol POP3 user "*@example.org" there with password "Passw0rd!" ssl fetchall
    

    And the log said:

    Nov 16 18:20:23 core fetchmail[61595]: 3 Messages for *@example.org on pop.1and1.com (21260 Bytes).
    Nov 16 18:20:23 core fetchmail[61595]: Message *@[email protected]:1 of 3 (3907 Bytes) deleted
    Nov 16 18:20:23 core postfix/local[56731]: 294BE15C0866: to=<fetchmail@localhost>, relay=local, delay=0.42, delays=0.27/0/0/0.15, dsn=2.0.0, status=sent (delivered to mailbox)
    Nov 16 18:20:23 core fetchmail[61595]: Message *@[email protected]:2 of 3 (4516 Bytes) deleted
    Nov 16 18:20:23 core postfix/local[56575]: 7496F15C0876: to=<fetchmail@localhost>, relay=local, delay=0.3, delays=0.27/0/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
    Nov 16 18:20:23 core fetchmail[61595]: Message *@[email protected]:3 of 3 (12837 Bytes) deleted
    Nov 16 18:20:24 core postfix/local[56731]: C11DC15C0866: to=<fetchmail@localhost>, relay=local, delay=0.24, delays=0.2/0/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
    

    Thanks in Advance for any idea's!

  • Lambert
    Lambert over 8 years
    You did not try the local-user literally did you? You need the actual name of the local user where you want to deliver the mails to... Nevertheless, thanks for posting your working solution, it will help other people.
  • Sara Deh
    Sara Deh over 8 years
    I tested it! The problem is that the recipient is dynamic. So i have no "local-user" or "johndoe" for example.