====== Choose relay based on recipient domain ====== To choose an SMTP relay server based on the recipient domain. /etc/postfix/main.cf #relayhost = #Remove any relayhost entry smtp_sender_dependent_authentication = yes transport_maps = hash:/etc/postfix/transport /etc/postfix/transport yahoo.com smtp:smtp.someotherserver.com Run the following postmap /etc/postfix/transport service postfix restart ===== 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) smtp_sender_dependent_authentication = yes transport_maps = hash:/etc/postfix/transport /etc/postfix/transport add below. This will cause only gmail to be delivered via localhost (and it's WAN IP) as SMTP. gmail.com smtp: ==== References ==== * http://www.postfix.org/transport.5.html * http://www.postfix.org/postconf.5.html#smtp_sender_dependent_authentication