254926Re: header checks not working
- Jul 1, 2009Jason Bailey, Sun Advocate Webmaster wrote:
> Rob Brandt wrote:No need to escape "-" or ":", and postfix turns on the /i flag
>> 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?
> 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.
by default - adding the flag to a postfix expression turns on
Rob's trouble is he forgot the ":" at the end of the header name.
-- Noel Jones
- << Previous post in topic Next post in topic >>