Postfix: Block Sender (en)
Jump to navigation
Jump to search
cd /etc/postfix vi sender_access
Enter the addresses you want to block:
user@abadboy.com REJECT myfriend@example.com OK junk@spam.com REJECT marketing@ REJECT theboss@ OK deals.marketing.com REJECT somedomain.com OK
Save & close file. Run postmap to create the database:
postmap hash:sender_access
Edit main.cf & add:
smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/sender_access
Restart postfix:
/etc/init.d/postfix restart
You can also use spamassassin to blacklist email addresses. Just add to your own spamassassin configuration or to the /etc/mail/spamassassin/local.cf file:
vi /etc/mail/spamassassin/local.cf
Append blacklist as follows:
blacklist_from user@abadboy.com
Save and close the file. Restart spamassassin:
/etc/init.d/spamassassin restart
Spamassassin will mark mail as SPAM instead of rejecting it.