I have two email servers: mx1.example.com
(IMAP, SMTP) and mx2.example.com
(SMTP gateway).
mx1.example.com
is handling email forexample.com
,example.net
andexample.org
.mx2.example.com
is configured as a gateway formx1.example.com
(I want him to send out all mails that originate frommx1.example.com
)
Now I want to send the emails
- from
example.com
andexample.net
viamx1.example.com
normally - from
example.org
viamx1.example.com
(password auth) to the gatewaymx2.example.com
(IP).
How can I configure this?
UPDATE: Please hurry up guys, the bounty expires in 2 days.
To be more clear:
I know how to relay via mx2.example.com
(how to send everything via mx2.)
I just have to put the IP of mx2 in relayhost in the main.cf in mx1. But I want to make this selectively, just for example.org.
you cannot use transport as it is used to transport emails to the MAILBOX, you need to use
it works like this in your main.cf:
/etc/postfix/relaymap looks like this :
by using the selective relay feature:
on mx1.example.com:
add a line :
example.org smtp:mx2.example.com
to /etc/postfix/transportadd a line :
transport_maps = hash:/etc/postfix/transport
to /etc/postfix/main.cfpostmap /etc/postfix/transport
postfix reload
on mx2.example.com :
mx1.example.com
to mynetworks in /etc/postfix/main.cfmake sure you have something like:
smtpd_relay_restrictions = permit_mynetworks, reject_unauth_destination
in /etc/postfix/main.cf it is missingpostfix reload
Postfix to relay mails to other SMTP for particular domain
http://www.postfix.org/STANDARD_CONFIGURATION_README.html
http://www.postfix.org/SMTPD_ACCESS_README.html#lists
https://xdeb.org/post/2017/12/20/mail-relay-mx-backup-and-spam-filtering-with-postfix/
https://www.howtoforge.com/community/threads/postfix-relay-one-domain-to-smarthost-a-all-else-to-smarthost-b.62955/
http://verchick.com/mecham/public_html/spam/relay_recipients.html