Configuring your Postfix to use smarthost

 

Routing all mails to a smarthost :

assume the postfixconfig files live in /etc/postfix/main.cf

In/etc/postfix/main.cf add the line:

relayhost = my.smarthost.fqdn:587

Routing all mails for a specific domain to a smarthost :

Add a line to /etc/postfix/transport:

thedomain.com my.smarthost.fqdn:587

generate a postmap file :

postmap hash:/etc/postfix/transport

To use the transport file, add or edit a line in /etc/postfix/main.cf:

transport_maps = hash:/etc/postfix/transport

Restart Postfix and all mail. The mail for selected domains should go trough the Smarthost.

* Some MTA accepts mail submission on port 587 only while some accepts on port 25 only.