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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Please note: This feature is available in Postfix 2.7 and later.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

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?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.