Skip to content

Postfix Block Domains

To block Emails to/from specific domains, start by creating the access list file (e.g. /etc/postfix/access):

$ nano /etc/postfix/access

In there, add domain names followed by the action (DISCARD or REJECT). We recommend DISCARD:

spamdomain01.com DISCARD
spamdomain02.com REJECT

Tell postfix to use that file. Edit mail.cf and add/update smtpd_sender_restrictions header:

$ nano /etc/postfix/main.cf
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access

After you finish, postmat the file to prepare postfix to use it (every time you modify the file).

$ postmap /etc/postfix/access

Restart Postfix.

https://www.cyberpunk.rs/mail-server-setup-postfix

Mail_server_setup__Postfix__Dovecot__MySQL__SpamAssasin_

Edited by peturbg