Postfix ignore catchall relayhost

October 13, 2011    email postfix relayhost

Postfix has an option where you can setup a relayhost to send all mail to another mail server. It looks something like

relayhost = [mail.domain.com]:25

So that will send all mail being sent out from the server to mail.domain.com on port 25. So what happens if you want to send mail that is sent to company.com out that server and not through another relay. You would do the following in main.cf

transport_maps = hash:/etc/postfix/transport

Then your /etc/postfix/transport would look something like

company.com :
* smtp:[mail.domain.com]:25

Then you want to run

postmap /etc/postfix/transport

Then reload postfix

service postfix reload

Now all mail for company.com will send out that server while all other mail will go through mail.domain.com:25



comments powered by Disqus