[Mailman-Developers] anti-spam filter

Barry Warsaw barry at list.org
Fri Apr 19 02:04:50 CEST 2013


On Apr 18, 2013, at 10:32 PM, Patrick Ben Koetter wrote:

>And that handler would be - excuse my ignorance I don't program - a Python
>function to handle a Python program? Could the handler pass a message over to
>e.g. SpamAssassin (Perl) or openDKIM (c code) or any other non Python program
>without the need to add any additional (Python) code?

In Mailman 3, it would be a class implementing an interface.

I still think this wouldn't be a handler, but a rule.  Although there's no
such distinction in MM2, there is in MM3: rules don't modify the message,
handlers do.

E.g. the IRule interface has a check() method that takes three arguments, the
mailing list, the message, and the metadata.  It returns a boolean specifying
whether the rule matches or not.

Thus a SpamAssassin rule might look like:

@implementer(IRule)
class SpamAssassin:
    # See IRule for details.
    name = 'spamassassin'
    description = _('See if SpamAssassin thinks this message is spam')
    record = True

    def check(self, mlist, msg, msgdata):
        spam_score = shell_out_to_sa(msg)
        msgdata['spamassassin_score'] = spam_score
        return spam_score > some_threshold

-Barry


More information about the Mailman-Developers mailing list