Loading ...
Sorry, an error occurred while loading the content.

254926Re: header checks not working

Expand Messages
  • Noel Jones
    Jul 1, 2009
      Jason Bailey, Sun Advocate Webmaster wrote:
      > 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

      No need to escape "-" or ":", and postfix turns on the /i flag
      by default - adding the flag to a postfix expression turns on
      case sensitivity.

      Rob's trouble is he forgot the ":" at the end of the header name.

      -- Noel Jones
    • Show all 20 messages in this topic