Click Technology

Linux, Windows, Mac it's all good

Ban a sender from sending you mail on Postfix


This is quite handy and easy to set up.

First, open up, the principal configuration file in Postfix. I use vim, but of course you can use whatever editor you like, e.g. vi, nano etc.

sudo vim /etc/postfix/

In your, add the following lines in the configuration

smtpd_sender_restrictions =
        check_sender_access hash:/etc/postfix/sender_access

Now, create a file to store the list of banned names.

sudo touch /etc/postfix/sender_access

and now edit it to add the banned names…

sudo vim /etc/postfix/sender_access

Add the banned addresses in the following format.. REJECT REJECT REJECT REJECT REJECT

Save the file. Now, create the hashed db file for this file..

sudo postmap /etc/postfix/sender_access

Now you should have a file in the /etc/postfix directory called /etc/postfix/sender_access.db

Now all you need to do is restart postfix.

sudo service postfix restart


posted under Linux Tips | No Comments »

This is my website for short blog posts and interesting materials that are noteworthy or have some handy-tip value.