Open dismasc opened 4 years ago
Hi Dismas,
Now I do not understand where was the first message with ID 671E024406B7 was triggered from or is this how postfix works or postforward sent it again after it rewrote it?
Postforward indeed submits new mail into the queue (by executing sendmail
) which is why you'll see a pickup entry with a new message ID.
This problem in your configuration that is causing postfix to run into a mail forwarding loop appears to be in the service definition:
postforward unix - n n - - pipe flags=ODR user=vmail:vmail argv=/usr/local/bin/postforward --path /usr/sbin:/sbin:/usr/bin:/bin ${recipient}
The argument to postforward
needs to be the email address that needs to be forwarded to, not the original recipient.
By using ${recipient}
above, you're specifying the original recipient, which postfix correctly determines ends up in a forwarding loop (if it accepts this mail, it goes through postforward again, which submits it back to itself, puts it through postforward again, and so on and so on).
If all mail for branddomainname.com
needs to go to the same forwarded recipient, you could put that address in place of ${recipient}
above. If you have multiple different addresses, I cannot think of any way to achieve this other than to define specific transports for each of them so you end up with something like:
# /etc/postfix/master.cf
postforward_foo unix - n n - - pipe flags=ODR user=vmail:vmail argv=/usr/local/bin/postforward --path /usr/sbin:/sbin:/usr/bin:/bin foo@host.tld
postforward_bar unix - n n - - pipe flags=ODR user=vmail:vmail argv=/usr/local/bin/postforward --path /usr/sbin:/sbin:/usr/bin:/bin bar@host.tls
# /etc/postfix/transport
foo@branddomainname.com postforward_foo:
bar@branddomainname.com postforward_bar:
Hi Zoni,
Thank you for your time and answer. I hope you and your family are in good health in this pandemic era.
Unfortunately, I have tried it and it does not work. But anyhow, if it would need manual addition on every forwarding email addresses (aliases), then I guess I just have to accept to live with the fact that aliases would be forwarded as unauthenticated and would broke the SPF.
The world does not have COVID-19 vaccine yet as I was writing this comment, and so what is the big deal with forwarded emails breaking the SPF ;).
Once again, thank you, Dismas.
Hello, I am configuring an email server for a company (not a hosting company, but a travel company). And I need help in configuring postforward to work with postfix pipe(8) delivery agents.
THE CONFIGURATION
The domains and mailboxes are stored in the MySQL Database so in /etc/postfix/main.cf:
The daemon postsrsd is running as well, this is the config for postsrsd in /etc/postfix/main.cf:
And also followed your suggestion for the postforward policy when configured in Postfix PIPE(8)
Then in my /etc/postfix/master.cf, I registered the postforward service:
Finally to make this all hooked, I created a transport map file /etc/postfix/transport, and put this line:
And went back to my /etc/postfix/main.cf, I added:
For now I wish the postforward only installs for the branddomainname.com and not other domain names (so other departments don't complain when something happens during this setup).
Of course I did not forget to do this:
AND NOW THE EXECUTION OF THE TEST
I sent an email from iamthesender@gmail.com to order@branddomainname.com, where order@branddomainname.com has only one alias that is to iamthealias@gmail.com.
THE RESULT OF THE TEST AND IT IS THE ISSUE
Unfortunately after many trials, this does not work, In the log, I found out the email which was only sent once has doubled:
And then, I followed both of the MAIL-ID, and here is what I found on the log:
671E024406B7:
AA7D82440708:
If you take a look at the second message with ID AA7D82440708, postforward is working and has rewrote the from to the following:
Now I do not understand where was the first message with ID 671E024406B7 was triggered from or is this how postfix works or postforward sent it again after it rewrote it?
I hope that I could get some answers on this problem.
Staysafe
Thank you, Dismas