Postfix: relay mail to smart host for specifc users

9,002

This can be achieved with transport_maps = hash:/etc/postfix/transport in main.cf

#/etc/postfix/transport
domain1.com     local:
[email protected]       smtp:smart.host1.com:25
domain2.com             local:
[email protected]       smtp:smart.host1.com:25
[email protected]       smtp:smart.host2.com:25
domain3.com             local:
Share:
9,002

Related videos on Youtube

Steve Taylor
Author by

Steve Taylor

Updated on September 18, 2022

Comments

  • Steve Taylor
    Steve Taylor over 1 year

    Currently i have a VPS that has a host of email accounts on for several domains.

    most are simple and have all local mailboxes.

    but i have one user that wants to have a hosted exchange account but leave all the others as they are.

    So what i would like to do is:

    Domain1.com - Deliver all mail localy (as it currently does)

    Domain2.com - [email protected] -> send to smart.host1.com - all others treated as local.

    then there is also a possibilty that i could have:

    Domain3.com - [email protected] -> send to smart.host1.com - [email protected] -> send to smart.host2.com - all others treated as local.

    it also may use useful if i could specify a outgoing smarthost per domain name.

    Im sure this has to be possible.

    Hope this makes sense!

  • Steve Taylor
    Steve Taylor about 10 years
    I cant seem to get this to work, Currently i have got relayhost = outbound.smarthost.com would this effect any of the above?
  • clement
    clement about 10 years
    Please see postconf transport_maps override relayhost parameter. U can have a * smtp:outbound.smarthost.com:25 line in your transport file as a workaround
  • Kalle Richter
    Kalle Richter over 9 years
    It's necessary to run postmap /etc/postfix/transport and restart the service or at least invoke service postfix reload after creating transport and changing main.cf.