
I'd like to write a filter for the Courier MTA which will run mailman's approval and spam tests before accepting messages to mailing lists. My filter framework is in python, so I think I can import the relevant bits of mailman (I'd like to start with MM2.1 compatibility). Can I get any pointers to the functions that check the sender for approval, and for the spam-specific posting filters?

Gordon Messmer wrote:
I'd like to write a filter for the Courier MTA which will run mailman's approval and spam tests before accepting messages to mailing lists. My filter framework is in python, so I think I can import the relevant bits of mailman (I'd like to start with MM2.1 compatibility). Can I get any pointers to the functions that check the sender for approval, and for the spam-specific posting filters?
Everything is done by the handler modules in Mailman/Handlers. IncomingRunner processes the message by calling the process() function of each module in the GLOBAL_PIPELINE list in turn until the pipeline is exhausted or a handler raises an exception.
See the definition of GLOBAL_PIPELINE in Defaults.py and the SpamDetect.py, Approve.py, Moderate.py and Hold.py handlers in particular.

Mark Sapiro wrote:
Everything is done by the handler modules in Mailman/Handlers. IncomingRunner processes the message by calling the process() function of each module in the GLOBAL_PIPELINE list in turn until the pipeline is exhausted or a handler raises an exception.
See the definition of GLOBAL_PIPELINE in Defaults.py and the SpamDetect.py, Approve.py, Moderate.py and Hold.py handlers in particular.
Thanks. I got a chance to look at this today. Since I only need an indication of whether or not the message will be rejected by mailman, I believe that I can use SpamDetect and Approve directly. However, I'd need to make sure that messages aren't held as a result of the examination. I'm not sure yet whether it'll be less ugly to make a work-alike function from Moderate.process(), leaving out the Hold bits, or perhaps import Moderate, and then replace Hold therein with one that does nothing. Any thoughts before I start?
participants (2)
-
Gordon Messmer
-
Mark Sapiro