united states of america usa  linkedinfacebookgoogle
Postfix: drop a particular email

postfix-emailSometimes we have emails going to a particular address, which cannot be stopped. There are many reasons, but most common is an invalid address, which pollutes the mail queue with invalid entries. The simplest way to solve this is by adding a DISCARD directive for postfix. 

If you don't have it already, add this line in main.cf

header_checks = regexp:/etc/postfix/header_checks

Create the file (or add to it, if you already have one):

/blockemail@example\.com/    DISCARD

Finally, restart postfix:

/etc/init.d/postfix restart

The file header_checks is very useful for other things. You can, for example, add a subject line to the logs using header_checks file:

/^Subject:/ INFO

The above command directs postfix to save the Subject into the logs. This makes things easier when searching for an email in the logs. The code can be separated by line in header_checks. Keep in mind that the more you add to it, the slower postfix becomes.

If you need help with Postfix or other Linux related issues, feel free to contact us and our team of IT consultants will be happy to assist you.

ALT – your Miami IT support experts!

Tel: (786) 646-6461   |   Toll-Free: (877) 454-0758
1990 NE 163rd St, Suite 215, North Miami Beach, FL 33162, USA
Privacy Policy