[Mailman-Users] non-member approval based on header.

Mark Sapiro msapiro at value.net
Sat Feb 3 00:34:57 CET 2007


John wrote:

>Has anyone implemented an automatic non-member approval based on a header value?


A couple of remarks.

You can't do this with header_filter_rules because the accept action
merely passes this check; it doesn't unconditionally accept the
message.

This is not hard to do with a custom handler. See
<http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq04.067.htp>
for information on installing such a handler. A skeleton of the
handler itself is simply

def process(mlist, msg, msgdata):
    # Get the contents of the header (X-My-Header:)
    contents = msg['x-my-header']
    if not contents:
        # header not present or was empty - to distinguish these
        # test contents == None for header not present
        return
    # some test on contents here. To accept message set
    # msgdata['approved'] = 1
    return


This handler would need to be in the pipeline preceding Moderate. The
one caveat is it will also bypass all the holds in the Hold handler.
If this is an issue, you could set some new flag in msgdata and modify
Moderate to skip the membership test based on that flag.

-- 
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