Postfix: deliver mail to specific emai addresses locally and send the rest to relayhost

postfix

I want to achieve the following with postfix:

Almost all outgoing emails shall be sent via a relayhost, configured in main.cf with

relayhost = my.mailserver

There's one specific email address (bugs@mydomain.com) for which I want the email to be delivered locally. I set up a local account on the machine to match the email address and added "mydomain.com" to the mydestination property in main.cf. Then of course postfix tries to deliver every email to @mydomain.com locally and bounces them because the respective user doesn't exist.

Question Hybrid gmail MX + postfix for local accounts seems to be somewhat related (though more complicated).

Best Answer

I finally figured out the correct syntax in the transport configuration file:

Add the following to /etc/posfix/transport:

bugs@mydomain.com :
*    relay:[my.mailserver]

and run

postmap transport
postfix reload
Related Topic