-1

I'm looking to set up Postfix to route emails from domaina.com to Gateway A, but if the email contains any other domain, I'd like it to be sent to Gateway B instead.

I was wondering if it's possible to implement this logic in the transport map. Here's what I have in mind:

abc.com    smtp:gateway1.server.123.com
(abc.com + "*")   smtp:obgw.123.com
"*"               smtp:obgw.123.com

I really want to avoid splitting the email traffic into two, especially when obgw.123.com can deliver to abc.com accounts as well.

If you have any insights or solutions, I'd love to hear from you.

Thanks a lot, Dub

1

2 Answers 2

0
# Route all internal mails to local transport
yourdomain.com :                          

# Route domain A -> gateway A. [] indicates that MX lookup is disabled. 
domainA.com : smtp:[gatewayA.com]       
  
# Route all other domains -> gateway B. 
* : smtp:[gatewayB.com]                   

0

I don't believe this is possible. Decisions about routing are either by default or per-recipient, not based on combinations of recipient. What you can do is to send the domaina.com recipients via Gateway A and other recipients via Gateway B. Since "other recipients" is not well defined, then you should configure Gateway B as the default and add a custom transport for domain A, e.g.

/etc/postfix/transport:

domaina.com  smtp:[gatewaya]

/etc/postfix/main.cf:

...
relayhost = [gatewayb]
transport_maps = hash:/etc/postfix/transport
...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .