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:
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_base = /var/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_alias_expansion_limit=2500
The daemon postsrsd is running as well, this is the config for postsrsd in /etc/postfix/main.cf:
#follow postforward suggestion in github when use with postsrsd
#sender_canonical_maps = tcp:localhost:10001
#sender_canonical_classes = envelope_sender
recipient_canonical_maps = tcp:localhost:10002
recipient_canonical_classes= envelope_recipient,header_recipient
And also followed your suggestion for the postforward policy when configured in Postfix PIPE(8)
#postforward policy
postforward_destination_recipient_limit = 1
Then in my /etc/postfix/master.cf, I registered the postforward service:
postforward unix - n n - - pipe flags=ODR user=vmail:vmail argv=/usr/local/bin/postforward --path /usr/sbin:/sbin:/usr/bin:/bin ${recipient}
Finally to make this all hooked, I created a transport map file /etc/postfix/transport, and put this line:
branddomainname.com postforward:
And went back to my /etc/postfix/main.cf, I added:
transport_maps = hash:/etc/postfix/transport
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:
postmap transport
systemctl restart postfix
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:
Apr 30 11:59:59 corp115486 postfix/cleanup[17988]: 671E024406B7: warning: header Subject: Test #2 30 April 2020 from mail-ua1-f48.google.com[209.85.222.48]; from=<iamthesender@gmail.com> to=<order@branddomainname.com> proto=ESMTP helo=<mail-ua1-f48.google.com>
Apr 30 12:00:00 corp115486 postfix/cleanup[17988]: AA7D82440708: warning: header Subject: Test #2 30 April 2020 from local; from=<SRS0=voml=6O=gmail.com=iamthesender@thecompanydomain.com> to=<order@branddomainname.com>
And then, I followed both of the MAIL-ID, and here is what I found on the log:
671E024406B7:
Apr 30 11:59:59 corp115486 postfix/smtpd[17981]: 671E024406B7: client=mail-ua1-f48.google.com[209.85.222.48]
Apr 30 11:59:59 corp115486 postfix/cleanup[17988]: 671E024406B7: message-id=<CAE7sF+GUdfepxMWW-Z9Ez6Go6wN8dG5nTGmvSk25sJUs5w5hng@mail.gmail.com>
Apr 30 11:59:59 corp115486 postfix/cleanup[17988]: 671E024406B7: warning: header Subject: Test #2 30 April 2020 from mail-ua1-f48.google.com[209.85.222.48]; from=<iamthesender@gmail.com> to=<order@branddomainname.com> proto=ESMTP helo=<mail-ua1-f48.google.com>
Apr 30 12:00:00 corp115486 opendkim[4178]: 671E024406B7: mail-ua1-f48.google.com [209.85.222.48] not internal
Apr 30 12:00:00 corp115486 opendkim[4178]: 671E024406B7: not authenticated
Apr 30 12:00:00 corp115486 opendkim[4178]: 671E024406B7: DKIM verification successful
Apr 30 12:00:00 corp115486 postfix/qmgr[17865]: 671E024406B7: from=<iamthesender@gmail.com>, size=2916, nrcpt=2 (queue active)
Apr 30 12:00:00 corp115486 postfix-rate-limit-snail/smtp[17872]: 671E024406B7: to=<iamthealias@gmail.com>, orig_to=<order@branddomainname.com>, relay=gmail-smtp-in.l.google.com[74.125.140.27]:25, delay=2.6, delays=2.3/0/0.14/0.14, dsn=2.0.0, status=sent (250 2.0.0 OK 1588222800 z16si463811wrl.168 - gsmtp)
Apr 30 12:00:00 corp115486 postfix/pipe[17992]: 671E024406B7: to=<order@branddomainname.com>, relay=postforward, delay=2.6, delays=2.3/0.01/0/0.34, dsn=2.0.0, status=sent (delivered via postforward service)
Apr 30 12:00:00 corp115486 postfix/qmgr[17865]: 671E024406B7: removed
AA7D82440708:
Apr 30 12:00:00 corp115486 postfix/pickup[17864]: AA7D82440708: uid=5000 from=<SRS0=voml=6O=gmail.com=iamthesender@thecompanydomain.com>
Apr 30 12:00:00 corp115486 postfix/cleanup[17988]: AA7D82440708: message-id=<CAE7sF+GUdfepxMWW-Z9Ez6Go6wN8dG5nTGmvSk25sJUs5w5hng@mail.gmail.com>
Apr 30 12:00:00 corp115486 postfix/cleanup[17988]: AA7D82440708: warning: header Subject: Test #2 30 April 2020 from local; from=<SRS0=voml=6O=gmail.com=iamthesender@thecompanydomain.com> to=<order@branddomainname.com>
Apr 30 12:00:00 corp115486 opendkim[4178]: AA7D82440708: no signing table match for 'iamthesender@gmail.com'
Apr 30 12:00:00 corp115486 opendkim[4178]: AA7D82440708: DKIM verification successful
Apr 30 12:00:00 corp115486 postfix/qmgr[17865]: AA7D82440708: from=<SRS0=voml=6O=gmail.com=iamthesender@thecompanydomain.com>, size=4440, nrcpt=2 (queue active)
Apr 30 12:00:00 corp115486 postfix/pipe[17992]: AA7D82440708: to=<order@branddomainname.com>, relay=postforward, delay=0.26, delays=0.2/0/0/0.07, dsn=5.4.6, status=bounced (mail forwarding loop for order@branddomainname.com)
Apr 30 12:01:01 corp115486 postfix-rate-limit-snail/smtp[17873]: AA7D82440708: to=<iamthealias@gmail.com>, orig_to=<order@branddomainname.com>, relay=gmail-smtp-in.l.google.com[74.125.140.27]:25, delay=61, delays=0.2/60/0.15/0.29, dsn=2.0.0, status=sent (250 2.0.0 OK 1588222861 d6si1137819wrv.413 - gsmtp)
Apr 30 12:01:01 corp115486 postfix/bounce[18004]: AA7D82440708: sender non-delivery notification: 3DBCC24406F9
Apr 30 12:01:01 corp115486 postfix/qmgr[17865]: AA7D82440708: removed
If you take a look at the second message with ID AA7D82440708, postforward is working and has rewrote the from to the following:
SRS0=voml=6O=gmail.com=iamthesender@thecompanydomain.com
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
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