0

I just installed PostFix on Cent OS 7. I want to set up mail forwarding from an admin address to my Gmail account but I also want to block all emails that are sent to emails that are not addressed to that admin account. At the bottom of my /etc/postfix/main.cf file, I have

virtual_alias_domains = example.com
virtual_alias_maps = hash:/etc/postfix/virtual

transport_maps = hash:/etc/postfix/transport

From that same machine, if I send this email, its not received

echo "This is the body of the email" | mail -s "admin line 2" [email protected]

However, if I comment out the last line above (the "transport_maps = hash:/etc/postfix/transport" line), then the email goes through. How do I block emails sent to other domains but also keep my forwarding in place? The /etc/postfix/virtual file contains

[email protected] [email protected]

and the file /etc/postfix/transport contains

example.com    :
*              discard:

1 Answer 1

0

Instead of doing this in transport, look at the recipient list

In main.cf

smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recipient_access

in /etc/postfix/recipient_access

[email protected] OK
* DISCARD

You must log in to answer this question.

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