[Mailman-Users] Discard/Ban all messages pending moderation

Mark Sapiro mark at msapiro.net
Fri May 31 00:49:06 CEST 2013

On 05/30/2013 11:37 AM, Seun Ojedeji wrote:
> Hello,
> I was wondering, is there a way i could discard all pending moderation
> messages and also simultaneously add the sender's address to discard for
> subsequent mails?

If there aren't too many, it should be easy enough to go to the admindb
interface for the list and for each sender in the summary of held
messages, check the "Add xxx to one of these sender filters:" box and
select the 'Discards' radio button and finally check the 'Discard all
messages marked Defer' box and submit changes.

If there are so many that this is unwieldy, you could do this with a
withlist script. Something along the lines of the following totally
untested script:

from Mailman import mm_cfg
def discard(mlist):
    for id in mlist.GetHeldMessageIds():
        sender = mlist.GetRecord(id)[1]
        if sender not in mlist.discard_these_nonmembers:
        mlist.HandleRequest(id, mm_cfg.DISCARD)

See 'bin/withlist --help' for what to do with this.

Mark Sapiro <mark at msapiro.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