[Mailman-Users] removing incoming messages automatically?

Dat Bui dbui at staff.chariot.net.au
Thu Jul 25 03:24:15 CEST 2002


I use this script to do just that. copy and paste into a file (name it
clear_request) and put it in your mailman cronjob.
Your default cron job for mailman most likely mails admins at 5pm about
pending requests so you should run this script at 4:50pm or something.
HTH

#! /usr/bin/python
#
# Written by Donal Hunt
# April 23rd 2001
#
# argv[1] should be the name of the list.

"""Clear pending administrative requests for a list

Usage:
    clear_requests listname

Where:

    listname
        The name of the Mailman list you want to clear
        pending requests from.  It must already exist.

"""

import sys
import os
import string
import getopt
import paths
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import MailList
from Mailman import Errors
from Mailman import Message
from Mailman.Logging.Syslog import syslog


def usage(status, msg=''):
    if msg:
        print msg
    print __doc__ % globals()
    sys.exit(status)


def main():
    try:
        ml = MailList.MailList(sys.argv[1])
    except Errors.MMListError, e:
        usage(1, 'No such list: %s (%s)' % (listname, e))
    try:
        print 'No of Requests Pending: %s ' % ml.NumRequestsPending()
        print 'No of postings awaiting approval: %s ' %
ml.GetHeldMessageIds()
        print 'No of subsciptions awaiting approval: %s ' %
ml.GetSubscriptionIds()
        for i in ml.GetHeldMessageIds():
            ml.HandleRequest(i, 3)
        for i in ml.GetSubscriptionIds():
            ml.HandleRequest(i, 2, 'No subscription allowed - please mail
%s' % ml.owner[0] )

        print 'No of Requests Pending: %s ' % ml.NumRequestsPending()
        ml.Save()
    finally:
        ml.Unlock()

main()




----- Original Message -----
From: "Soon-Son Kwon" <kss at kldp.org>
To: <mailman-users at python.org>
Sent: Wednesday, July 24, 2002 11:19 PM
Subject: [Mailman-Users] removing incoming messages automatically?


> Hello, I am using mailman 2.0.11 on debian woody.
>
> I configured a list to accept messages from subscribers only
> so that unsubscribers' messages can be approved by admin manually.
>
> But these days some spammers started to send too many messages
> so deleting those messages takes quite time.
>
> Is there any way to configure mailman delete every messages
> from unsubscribers automatically and do not even notify it
> to the list admin?
>
> I tried to find some option for that in the admin interface but failed....
>
> Thanks in advance...
> --
> -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
>            (o_             **WTFM**
> (o_  (o_   //\
> (/)_ (/)_  V_/_        http://kldp.org
> -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
>
> ------------------------------------------------------
> Mailman-Users mailing list
> Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users
> Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
> Searchable Archives:
http://www.mail-archive.com/mailman-users%40python.org/
>





More information about the Mailman-Users mailing list