Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tech:linux:postfix_relay_on_recipient_domain [2015/01/09 06:47]
tech:linux:postfix_relay_on_recipient_domain [2015/01/09 06:47] (current)
Line 1: Line 1:
 +====== Choose relay based on recipient domain ======
 +To choose an SMTP relay server based on the recipient domain.  ​
  
 +/​etc/​postfix/​main.cf
 +<​code>​
 +#relayhost =
 +#Remove any relayhost entry
 +smtp_sender_dependent_authentication = yes
 +transport_maps = hash:/​etc/​postfix/​transport
 +</​code>​
 +
 +/​etc/​postfix/​transport
 +<​code>​
 +yahoo.com smtp:​smtp.someotherserver.com
 +</​code>​
 +
 +Run the following
 +<code bash>
 +postmap /​etc/​postfix/​transport
 +service postfix restart
 +</​code>​
 +
 +===== Alternate setup =====
 +The example below is to define alternate transport for given exceptions. ​ So the default will use what is configured in relayhost but defined domain names (in transport) will use an alternate.  ​
 +/​etc/​postfix/​main.cf (keep relayhost as is)
 +<​code>​
 +smtp_sender_dependent_authentication = yes
 +transport_maps = hash:/​etc/​postfix/​transport
 +</​code>​
 +
 +/​etc/​postfix/​transport add below. ​ This will cause only gmail to be delivered via localhost (and it's WAN IP) as SMTP.
 +<​code>​
 +gmail.com smtp:
 +</​code>​
 +
 +==== References ====
 +  * http://​www.postfix.org/​transport.5.html
 +  * http://​www.postfix.org/​postconf.5.html#​smtp_sender_dependent_authentication

QR Code
QR Code tech:linux:postfix_relay_on_recipient_domain (generated for current page)