[Mailman-Users] Header filtering regex issue

Mark Sapiro mark at msapiro.net
Tue Jul 7 22:54:58 CEST 2015

On 07/07/2015 12:41 PM, Sibi John wrote:
> None whatsoever !! which is what boggles my mind !

In reply to:
> -----Original Message-----
> From: Mailman-Users On Behalf Of Mark Sapiro
> Sent: July 07, 2015 2:40 PM
> To: mailman-users at python.org
> Subject: Re: [Mailman-Users] Header filtering regex issue
> On 07/07/2015 04:43 AM, Sibi John wrote:
>> In my spam filter rules, this is the regex that I have and it matches perfectly.
>> From: .+@(?!(xxx|yyy)\.com).+
>> For some reason, it discards all email and I cannot seem to figure out what I am doing wrong. Any suggestions ?
> The regexp should work. It might match some desired addresses like user at sub.xxx.com and not match some undesired ones like user at xxx.com.au, but it should work for the obvious cases.
> Do you have any other header_filter_rules? If so, what are they?

Actually, there is a problem with your regexp. header_filter_rules
regexps are searched (re.search, not re.match) in multiline mode case
insensitively. This your regexp will match 'from:' in other places in
the headers. Try

^From: .+@(?!(xxx|yyy)\.com).+

to match only a true 'From: header.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list