0

I would like to create a spam filter that spans multiple lines in headers. This is my /etc/postfix/header_checks file:

/^From:.*name[0-9]+@.+[\r\n]+To:.*name@domain\.com/  REJECT

It's a valid regex, but doesn't work, because header_checks applies the filters to one line at a time. How can I check for multiple headers at the same time? Matching against the whole raw headers block would work just fine, but I can't find an option for that.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
blade
  • 109
  • 1
  • 3
  • 1
    `but I can't find an option for that.` ---> Yes your desired option doesn't exist in Postfix. You need **external** content filter to achieve your goal. – masegaloeh Mar 10 '15 at 08:57
  • @masegaloeh can you suggest some simple external filter that could do this? – blade Mar 10 '15 at 12:51
  • 1
    You can start by visiting the [postfix addon page](http://www.postfix.org/addon.html) – masegaloeh Mar 10 '15 at 12:57

1 Answers1

-1

Maybe an option to this case is put a conditional in the header field:

/^(From|To):.*name[0-9]+@.*/  REJECT