Rob Brandt wrote:
I'm trying to set up a basic header check to get rid of emails sa marks as spam. I've added the following link to main.cf:

header_checks = regexp:/etc/postfix/filter

/etc/postfix/filter has:


# No ***SPAM***
/^Subject .*\*\*\*SPAM\*\*\*/    DISCARD ***SPAM***
# SPam flag
/^X-Spam-Flag .YES/    DISCARD Spam Flag

The intent is to discard emails where either the subject contains ***SPAM*** or the X-Spam-Flag is YES

But the filters aren't working. I am by no means a regex expert. What am I missing?

Rob


I'm no Postfix master (not by a long shot), nor do I have a machine I can test this on, but try this:

/^X\-Spam\-Status\:.*YES/i      DISCARD

Since you say your header is different, maybe this:
/^X\-Spam\-Flag\:.*YES/i        DISCARD

I suppose it depends on the name of the header. I have SpamAssassin marking my email and the header is X-Spam-Status, not X-Spam-Flag.

The "/i" at the end implies case insensitivity when matching. I'm not sure if Postfix honors such pattern modifiers, but generally speaking, when dealing with Perl-compatible regex, that's what the "i" does. If Postfix doesn't like it, just take the "i" out.

Jason

Reply via email to