Postfix: Block sender

From SpeedyWiki

Jump to: navigation, search


Q. I’ve Postfix based CentOS Linux server. I need to blacklist email ID: . How do I blacklist email address with postfix? I also have spamassassin software installed.

A. By default, the Postfix SMTP server accepts any sender address. However you can block / blacklist sender email address easily with Postfix. It has SMTP server access table.

Open /etc/postfix/sender_access file

  1. cd /etc/postfix
  2. vi sender_access

Append sender email id as follows: REJECT Save and close the file. Use postmap command to create a database:

  1. postmap hash:sender_access

Now open and add code as follows: smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/sender_access Save and close the file. Restart / reload postfix MTA:

  1. /etc/init.d/postfix restart

You can also use spamassassin to blacklist email address. Just add to your own spamassassin configuration or to /etc/mail/spamassassin/ file:

  1. vi /etc/mail/spamassassin/

Append blacklist as follows: blacklist_from Save and close the file. Restart spamassassin:

  1. /etc/init.d/spamassassin restart

spamassassin will marke mail as SPAM instead of rejecting the same.

[edit] Referensi

Personal tools