1

I'm trying to REJECT an email with a certain phrase in the SUBJECT (e.g. "quota limit") using Postix 2.9.6. Following the postfix's documentation I realized postfix handles this info by checking the header. So header_checks is the attribute designated for checking headers in the email. Knowing this I added this line in my main.cf file:

header_checks = regexp:/etc/postfix/acl/header_checks/regexp

and the regexp:/etc/postfix/acl/header_checks/regexp fle contains:

/^Subject.*quota limit.*/  REJECT "SPAM ID:HeaderChecks01  Possible SPAM"

Following I validated the setting using (see quota limit in the subject):

postmap -q "Subject:squota limitjk" regexp:/etc/postfix/acl/header_checks/regexp

and I got:

REJECT "SPAM ID:HeaderChecks01  Possible SPAM"

It works!! Any message with this quota limit phrase in the subject should be automatically REJECTED. The thing is it's not. Then I checked the official documentation for postfix regarding to header_checks in here: header_checks . Apparently I'm doing things right. Why isn't this working?? Before posting this I noticed there are previous questions in this great site (serverfault) regarding this very same problem and all of them without an accurate answer. You can check them here: Postfix header_checks not working and Postifx header_checks not working

For a more close-to example I copied to a local file a piece of plain text from a real (not real domain included) SPAM email and did the same postmap -q check and got the same result. So doesn't seems to be a regexp problem at all. The text is this (see quota limit in the subject):

Reply-To: j.p.monfort.accomplish.delivery@timetelegram.info
Message-ID: <0f12fc934ada9939316f6986001319ff@timetelegram.us>
From: "ACCOMPLISH DELIVERY"
<j.p.monfort.accomplish.delivery@timetelegram.us>
To: <ielena@udomain.com>
Subject:=?windows-1252?Q?A_Spequota limitiversi_Aria_Pro._cia?=
<asdqtext to fill>

Last but not least I tried changing header_checks by smtp_header_checks, mime_header_checks, smtp_mime_header_checks, milter_header_checks and even nested_header_checks (just in case) and got nothing. I also checked for a receive_override_options param in the master.cf file and couldn't find it so there is no header_checks overridden.

To point out: Below header_checks I have smtp_body_checks and any email with the phrase "quota limit" is actually being rejected without any problem. It's only this attribute per se.

0

1 Answer 1

1

The correct solution to my post lies here: -o receive_override_options=no_header_body_checks

I just added the line -o receive_override_options=no_header_body_checks to my master.cf file without a comment and voilá. So far I have being doing what I wanted to in the beginning. I guess this entire post should be deleted or marked as duplicated.

Not the answer you're looking for? Browse other questions tagged or ask your own question.