Postfix drop a particular email

Print

 

Sometimes 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.

Original Article

 

Linux
Comments (1)
test
1 Saturday, 17 March 2018 19:41
Artem
test comment - ignore
yvComment v.1.24.0