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).


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
  • hmm this does not work for me - still relays 'bugs@mydomain.com'. – rynop Jan 23 '13 at 22:13

The correct way to do this is add the following to /etc/posfix/transport

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

Then add the following to /etc/postfix/main.cf:

transport_maps = hash:/etc/postfix/transport

Then run:

sudo postmap hash:/etc/postfix/transport
sudo /etc/init.d/postfix restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.