Postfix blacklist or reject an email address

65 Likes Comment

If you need to block some senders, you can do the following

Open /etc/postfix/sender_access file:

cd /etc/postfix
nano sender_access

Append sender email id as follows:

[email protected] REJECT

Save and close the file. Use postmap command to create a database:

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:

/etc/init.d/postfix restart

Every time after add new email to blacklist need to execute:

postmap hash:sender_access
/etc/init.d/postfix restart

About the Author: Oleksandr Sovenko

Leave a Reply

Your email address will not be published. Required fields are marked *