0

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

example:

relayhost = 192.2.123.25

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?

0

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.

/etc/postfix/transport

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

postmap /etc/postfix/transport

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

RTFM

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.