[Mailman-Users] spam filters should only match list-members

Mark Sapiro msapiro at value.net
Thu Jan 18 21:59:08 CET 2007

Bettina Hafter wrote:
>We have a list, which discards all non-members. We have 2 filters which 
>go for spams.
>1st filter, if the X-SPAM-header contains xxxxxxx, discard it
>2nd filter, if the X-SPAM-header contains xxxx, set it on hold
>now all the spamers which are marked by our spamassin with xxxx in the 
>mail-header are set on hold.
>is there a way to teach mailman to do something like that:
>- discard mails of non-members, regardless whether they match the 
>filters or not
>- make spam control only for members

The issue is because of the order in which things are done in the
pipeline of handlers that Mailman uses to process the mail.
header_filter_rules are processed by SpamDetect which is first.
Membership tests are done in Moderate which comes later. Once a
message is held, no more processing is done.

If you want to do the membership tests before header_filter_rules, you
can reorder the pipeline. This won't work in general because it would
apply a moderation hold or reject action or a nonmember hold or reject
action before the spam discard action, but in your case where the
nonmember action is discard, it may be OK

You could put the following lines in mm_cfg.py and restart Mailman to
put SpamDetect after Moderate.

GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Moderate') + 1,

(the GLOBAL_PIPELINE.insert line is wrapped by my MUA, but it doesn't
matter because of Python's 'automatic continuation within parentheses'

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