Mahesh's Blog

" It's hard to beat a person who believes in his or her own strength. And I believe in mine."

Saturday, September 07, 2013

Postfix reject bounced email address

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

Create /etc/postfix/sender_access file

# cd /etc/postfix
# nano sender_access


Append sender email id as follows:

email@example.com REJECT

Save and close the file.
Create a database with postmap:

# postmap hash:sender_access

Now open main.cf and add code as follows:

smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/sender_access

Save and close the file. Restart / reload postfix

# /etc/init.d/postfix restart