Debian 8 – How To Block Domains (Postfix)

If you are sure…

So, if you are sure you want to block all mail to/from the list of domains, you can add the following directive to your postfix main.cf file:

Code:
smtpd_sender_restrictions = hash:/etc/postfix/access
reject_unauth_destination = hash:/etc/postfix/access

Once this has been added to the main.cf, you need to create the /etc/postfix/access file and put entries in it like this:

Code:
aol.com     REJECT
yahoo.com   REJECT
msn.com     REJECT

So on and so forth until all the domains have been entered. Once you have created this file and the permissions are correct run the following command:

Code:
postmap hash:/etc/postfix/access

and finally restart postfix.