How can I configure Postfix to relay emails addressed to particular domains through a separate SMTP relay [duplicate]
Having some issues trying to get something working on postfix.
That is, I have a domain abc.com
which is a destination domain on my postfix server 1.2.3.4
, it hosts mailboxes for addresses in this domain locally by default - straight-forward.
However, I would like to be able to "relay" specific email addresses from within this same domain (say: [email protected]
) to another postfix server [5.6.7.8]:2525
- yet still retaining the original ability of being able to deliver mail to all other addresses *@abc.com
locally on my original postfix server 1.2.3.4
.
Is anyone able to advise how I can go about doing this?
Thanks in advance!
Cont.
Thanks tater, I've actually gone with something similar so far, but still have one issue.
So I have transport
file:
[email protected] relay:[5.6.7.8]:2525
*@abc.com local
And main.cf
:
relay_domains = abc.com
This config sends to the relay perfect as I want, but any other addresses (in the wildcard scope) do not get delivered as they try to go straight back out the default relay server (another server altogether), where-as instead I'd like them to hit /etc/aliases
or a local mailbox.
Solution 1:
One approach is to use transport maps. In main.cf
, have a line like
transport_maps = hash:/etc/postfix/transport
and then in the transport
file,
[email protected] smtp:5.6.7.8:2525
This is searched in most- to least-specific order, so if you wanted to specify something else for abc.com
you would do it like
[email protected] smtp:5.6.7.8:2525
abc.com smtp:1.2.3.4:25
but local
transport is the default, so if that's what you want a second line is not needed.