[Mailman-Users] How do I delete all members from a list in 2.0.13?

Bill Hilburn bhilburn at frontier.net
Mon Apr 7 22:49:45 CEST 2003


You have a couple of choices and both are actually pretty easy...

1.) Use ~/mailman/bin/list_members to dump users to a text file then 
~/mailman/bin/remove_users to remove them, add your self, test list then 
~/mailman/bin/add_members to add everyone in the text file back to the list.

2.) Simply sent all subscribers "NOMAIL" option to ON except yours, test then 
set "NOMAIL" off (off - unchecked = send them an email, ON - checked = don't 
send email)

Number one sounds a lot worse than it really is as you are just running 3 
scripts that already exist, just be really careful here, you could 
accidentally overwrite your subscriber list!

Number two is even quicker, I have included a python script here that I use 
for this exact same thing, probably could be a little cleaner but hey it works!

You need to be careful when you copy & paste this script different apps wrap 
lines in bad places as far as any code is concerned, note that the line 
starting with "statuses" (and the two lines after) should all be on one line...


Hope This Helps!


------------------------CUT HERE------------------------
#! /usr/local/bin/python
#
# This script when called as shown below (Usage:) will set subscribers
# "NOMAIL" option on or off
#
# Usage: ~/mailman/bin/withlist -r nomail <listname>
#
# NOTE:
#
# To set "NOMAIL" to on (do not send mail to subscriber)
# change the line "list.setDeliveryStatus(member, MemberAdaptor.ENABLED)"
# to list.setDeliveryStatus(member, MemberAdaptor.BYADMIN)
#
# To set "NOMAIL" to off (send mail to subscriber)
# change the line "list.setDeliveryStatus(member, MemberAdaptor.BYADMIN)"
# to list.setDeliveryStatus(member, MemberAdaptor.ENABLED)
#
# Notice the "if" that is commented out, remove the comment and this script
# will operate only on the email address specified here.
#
#

import sys
import getopt

import paths
from Mailman import mm_cfg
from Mailman.i18n import _

from Mailman import MemberAdaptor

def statusstr(status):
   return ('ENABLED', 'UNKNOWN', 'BYUSER', 'BYADMIN', 'BYBOUNCE')[status]

def nomail(list):

   statuses = (MemberAdaptor.ENABLED, MemberAdaptor.UNKNOWN, 
MemberAdaptor.BYUSER,
               MemberAdaptor.BYADMIN, MemberAdaptor.BYBOUNCE)

   for status in statuses:
      members = list.getDeliveryStatusMembers((status,))
      for member in members:
         print member, statusstr(status)
#         if(member == 'bhilburn at frontier.net'):
         list.Lock()
         list.setDeliveryStatus(member, MemberAdaptor.ENABLED)
         print _('Saving list')
         list.Save()
         list.Unlock()

   sys.exit(0)

------------------------CUT HERE------------------------



Quoting Daevid Vincent <daevid at daevid.com>:

> I am still running RH8 and the 2.0.13 mailman. I am writing some automation
> scripts that post to the list, but I don't want to keep 'spamming' all my
> members until it's done. (I'm the only one that posts to the list --
> announce only basically). What I want to do is somehow delete all the
> members, add just me, test my scripts, when satisfied, put all the members
> back (paste all email addresses or move a file back in place or whatever).
> I
> don't see a file that contains JUST the members?! There is one 'config.db'
> but it seems to be binary and possibly contain other stuff too.
> Suggestions?
> Are there some scripts/tools that will facilitate this. I'm curious as to
> why there isn't just a single file that has all the people in it and
> another
> with config stuff. Seems kind of short-sighted unless I'm missing something
> here.
> 
> 
> ------------------------------------------------------
> 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/
> 
> This message was sent to: bhilburn at frontier.net
> Unsubscribe or change your options at
> http://mail.python.org/mailman/options/mailman-users/bhilburn%40frontier.net
> 



Bill Hilburn
NOC Frontier Internet

-------------------------------------------------
This mail sent through frontier.net webmail service!




More information about the Mailman-Users mailing list