How can I configure Postfix to ignore relayhost when forwarding mail?
I currently use the relayhost to send all outgoing email via an external SMTP service :
# /etc/postfix/main.cf relayhost = [smtp.mandrillapp.com]
A couple of my domains are configured to send via an alternative SMTP service :
# /etc/postfix/relayhost_maps @domain1 [email-smtp.us-east-1.amazonaws.com] @domain2 [email-smtp.us-east-1.amazonaws.com]
However, a few of my customers have their incoming email forwarded to other accounts. I don't want to be sending forwarded email via my external SMTP service, instead I want it relayed directly by localhost.
For example, my machine accepts email for 'email@example.com', which the client has configured to be forwarded to 'firstname.lastname@example.org'. What I'm looking for is a way to have any emails forwarded to 'email@example.com' relayed directly by my server - and not relayed by my external SMTP service.
I think transport maps are close to what I need, and I have found lots of information on how to route to an external SMTP with transport mapping, but I can't figure how to relay from localhost only when forwarding mail.
I thought I had a solution here:
... but when I tried it, I sent an email to myself and received it 2,500 times in some sort of loop between my machine and my SMTP gateway, and had to quickly stop Postfix!
So, basically I want to relay forwarded messages from localhost, and non-forwarded messages via various SMTP services.