MailmanWiki

3.32. What's the regex syntax for header filter rules (in privacy options/spam filters)?

See also How do I accept or reject all addresses from a particular domain (e.g., wildcard addresses)?

Use this regexp to match messages with the word "Phentermine" (a well-known spam word) in their subject:

^Subject: .*Phentermine

or

\nSubject: .*Phentermine

Note that the entries in header filter rules are Python regular expressions. They are searched (not matched) in multiline mode ignoring case against a long string consisting of all the message headers and mime part headers strung together and separated by newline (\n) characters.

Note that prior to Mailman 2.1.6, the header string contained only the message headers and not the part headers, and prior to Mailman 2.1.7, the search was not done in multiline mode so only the second form with '\n' and not '^' would work.

See the section on 'Regular expression operations' in the Python library documentation at https://docs.python.org/2/library/re.html.

Also note that before Mailman 2.1.15, the headers were not RFC 2047 decoded so RFC 2047 encoded headers may not match as expected in pre 2.1.15 Mailman.

Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.

MailmanWiki: DOC/What's the regex syntax for header filter rules (in privacy options-spam filters)? (last edited 2015-01-29 06:37:26 by msapiro)