[Mailman-Users] Quick spam regex question

Mark Sapiro msapiro at value.net
Mon Jul 17 22:51:03 CEST 2006


Jason LaMar wrote:

>If I wanted to set up my Mailman spam filter to only accept list submissions
>for approval from *@fubar.com (for example) -- and automatically discard
>messages sent from any other domain -- what would be the easiest way to set
>that up in the spam filter rules?

This is complicated by the fact that prior to Mailman 2.1.7,
header_filter_rules regexps were not compiled in multiline mode, so
regexps involving ^ (beginning of line) matches probably won't match
in pre-2.1.7 Mailman. So avoiding that issue by using '\n' instead,
put the following regexp in Privacy options...->Spam
filters->header_filter_rules->Spam Filter Rule 1->Spam Filter Regexp:

  \nfrom:[^@]*@(?!fubar.com[>\s])

and set the action to discard. This pattern matches (case
insensitively) a newline followed by from: followed by anything up to
and including the first @ followed by anything other than fubar.com
and either > or white space (including newline).  See
<http://docs.python.org/lib/re-syntax.html>.

-- 
Mark Sapiro <msapiro at value.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