Postfix relay certain domain internal and external.

root# cat /etc/postfix/main.cf
--cut
relay_domains = $mydestination, hash:/etc/postfix/relaydomains
--cut
smtpd_sender_restrictions = hash:/etc/postfix/access
smtpd_client_restrictions = permit_mynetworks, check_client_access hash:/etc/postfix/acc
ess, reject
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination
--cut

root# cat /etc/postfix/relaydomains
domain.com OK
domain1.com OK

root# cat /etc/postfix/access
172.16.12.99 OK

root# cat /etc/postfix/mynetworks
172.16.12.100/32
172.16.12.101/32

Remember to run: postmap /etc/postfix/relaydomains and postmap /etc/postfix/access
172.16.12.99 is allowed to send e-mails just to domain.com and domain1.com via the relay server.
172.16.12.100 and 172.16.12.101 are allowed to send e-mails to everywhere via the relay server.

Leave a Reply

Your email address will not be published. Required fields are marked *

*