Postfix - Use smarthost for certain sending domains

We are looking for a way to route outgoing mail for some domains through a smarthost, and send the rest out using DNS.  The goal is to filter mail from certain senders through a smarthost while not affecting the other domains sending from the server.

Is there an easy way to configure this?  Any guides or references out on the web?
Who is Participating?
bevhostConnect With a Mentor Commented:
Looks like you're almost there except that the question asks for the smarthost to be changed depending on certain sender domains whereas the above solution is for certain recipient domains.

To do it based on sender domains instead see
Use this in step 3 above.
Are you looking for this?

1) File /etc/postfix/transport:

2) Then "postmap /etc/postfix/transport"

3) check you have this in
transport_maps = hash:/etc/postfix/transport

4) Reload postfix

5) configure this "" server to relay the outgoing server the way you want. It must be ok to accept/relay routed mails from your server

6) Test

Please note: This feature is available in Postfix 2.7 and later.
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

You may be able to achieve a similar result in lower versions of postfix using a check_sender_access table with result of FILTER smtp:[]

Note that the [] brakets prevents MX record lookup for (ie use A record)
TacoFlavoredKissesAuthor Commented:
Postfix is at version 2.5 currently.  Upgrading isn't really an issue though.  

I am going to upgrade this evening and test that out.  Thank you.
How did it go?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.