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?
LVL 1
TacoFlavoredKissesAsked:
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.

mchkorgCommented:
Are you looking for this?

1) File /etc/postfix/transport:
some.domain.com    smtp:an.alternate.smtp.com

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

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

4) Reload postfix

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

6) Test

Regards
0
bevhostCommented:
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
http://www.postfix.org/postconf.5.html#sender_dependent_default_transport_maps
Use this in step 3 above.
0

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
bevhostCommented:
Please note: This feature is available in Postfix 2.7 and later.
0
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.

bevhostCommented:
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:[an.alternate.smtp.com]

Note that the [] brakets prevents MX record lookup for an.alternate.smtp.com (ie use A record)
0
bevhostCommented:
0
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.
0
bevhostCommented:
How did it go?
0
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.