On 18 Mar 2014, at 19:12, Barry Warsaw <barry@list.org> wrote:
I see this was a private reply. Feel free to forward this on to the list if you want.
Thanks, Barry. I’ll have a go at that if I get time.
For me, the big win for spam prevention with mailing lists is the restriction on posters: it’s what keeps mailing lists relatively spam free. Most sites don’t like to bounce messages that they’ve previously accepted, so that means that the spam gets held for moderation, which creates a lot of work for list owners. If list bound mail can be rejected by the MTA at SMTP time, that would save a lot of work for list owners.
On Mar 18, 2014, at 02:58 PM, Ian Eiloart wrote:
That page suggests that Mailman 3 won’t be able to reject, at LMTP time, a message based on the sender/recipient information. That means that the MTA has to accept a message for delivery, even if Mailman is then going to reject it because the sender isn’t permitted to post to the list, or even just because the list doesn’t exist. Is that the case?
At the moment, yes, but if you're interested in working on this, here's a rough sketch that might work:
Amend LMTPRunner.process_message() to run the member-moderation and nonmember-moderation rules. Probably rather than hard coding this, create a short chain just for LMTP-acceptance processing. This would allow folks to customize what criteria the LMTP server uses to decide whether to accept the message or not.
.process_message() knows the name of the mailing list the message is destined for (via recipient inspection). It currently doesn't query the db for a mailing list object because it doesn't need it, but that would be easy to add. You've already got the message object, so just craft an empty metadata dictionary for the chain processing.
Probably make the link action for both rules LinkAction.stop so that the first one to hit wins. Then check the moderation_action to decide what the disposition should be. E.g. if Action.reject or Action.discard, you can issue the appropriate LMTP response code. If it's Action.hold, Action.accept, or Action.defer, accept the message at LMTP time and enqueue the message for full processing.
Cheers, -Barry
-- Ian Eiloart Postmaster, University of Sussex +44 (0) 1273 87-3148