Because of problems of IP/domain reputation (my server and domain very recent), I had to use Amazon SES as SMTP relay to be able to not have my mails flagged as spam.
My setup with Amazon was working fine, but impossible for me to do mail forwarding using Amazon SMTP, because the adress of the FROM header must be verified.
What I decided to do is to only send through Amazon the mails directly sent from my server, and to just use my own SMTP for the forwarding stuff. (Because the mails are signed by other servers with good reputation, even if the mail is sent by my server, its not flagged as spam)
To do that, I used the following settings :
relayhost = sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_maps sender_canonical_maps = regexp:/etc/postfix/sender_canonical sender_canonical_classes = envelope_sender smtpd_data_restrictions = check_sender_access pcre:/etc/postfix/sender_access
email@example.com [email-smtp.eu-west-1.amazonaws.com]:25 @domain2.tld [email-smtp.eu-west-1.amazonaws.com]:25 @domain3.tld [email-smtp.eu-west-1.amazonaws.com]:25 @domain4.tld [email-smtp.eu-west-1.amazonaws.com]:25 @domain5.tld [email-smtp.eu-west-1.amazonaws.com]:25
/(.*)/ prepend X-Envelope-From: <$1>
I'm relaying all the mails of my domain through amazon, except for domain1 which will be used for forwarding with the address firstname.lastname@example.org. I need to rewrite the envelope address, to be able to forward the mails.
My problem is that I would like to rewrite the envelope address only for the mails coming from outside of my server that I forward to external webmail. All the mails sent directly from my users webmails have to go through Amazon.