How-To: Configure Postfix to Relay based on Domain
We use Postfix as a dropin replacement for Sendmail on our servers. We wanted to configure postfix to relay email via our internal mail server for internal email addresses, and send directly if the email address was external.
To do this, follow these steps:
- Edit the /etc/postfix/transport file and add the following line:
- Edit the /etc/postfix/main.cf file and add the following line to the end:
- Run the following commands at the prompt:
myinternaldomain.com smtp:[ipaddress]:25
transport_maps = hash:/etc/postfix/transport
[root@triton postfix]# postfix /etc/postfix/transport [root@triton postfix]# service postfix restart
And you should be done!

Leave a Reply