I've set up a postfix server that relays email to another server, this is working fine. I managed this using the relayhost variable.


relayhost =

This means all incoming emails are sent to that server, which is good. However, local email sent from the server where postfix is installed, for example using:

$ mail -s "subject example" mike@example.com

are also being sent to the relay host, however, I only want this server to use relayhost for incoming email, for outgoing emails it should use itself as smtp. How can I achieve this?


Relayhost sets your next hop for all email that hits the postfix server. You could use transport maps to forward emails for a specific domain.


example.com   smtp:
.example.com  smtp:
*         smtp:[]

postmap /etc/postfix/transport

postfix -e transport_maps = hash:/etc/postfix/transport


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.