How to get a .csv of subscribers on all your Mailman lists

Posted by – May 16, 2009

The boss asked me to create a list of everyone subscribed to every discussion list we have. Ended up being like 3000 lines…luckly there is a python script that polls the mailman admin web interface. The below script makes it quite a bit easier to perform on all the lists.

First thing, you need a file with all of your list names – this works:

ls /usr/local/mailman/lists | cat > lists.txt ## This is where mailman is located on FreeBSD

Next, download mailman-subscribers.py to your home directory.

Finally, you need to create a shell script (i.e. getallsubscribers.sh) and paste the following (substitute the [[bracketed text]] with the info for your system):

while read line
do
 echo $line | cat >> listsAndMembers.csv
  ~/mailman-subscribers.py -c [[your.mailman.host]] $line [[listAdminPassword]] | cat >> listsAndMembers.csv
  echo | cat >> listsAndMembers.csv
  echo | cat >> listsAndMembers.csv
done < lists.txt
Now make the file executable and run it:
chmod +x getallsubscribers.sh
./getallsubscribers.sh

That's it. You should have a single file with all of your lists and their subscribers.

edit: It came up later that it would be nice to get a list of who from each domain was subscribed. This regex will turn up the listname and name/email for each subscriber in the .csv

(?:.*(?:gmail\.com)"|^[^"].*$)
4 Comments on How to get a .csv of subscribers on all your Mailman lists

Respond

  1. Bret Miller says:

    Awesome! Just what I was looking for. Thanks!

  2. Justin says:

    My pleasure!

  3. robert schwartz says:

    How do you get a list of users if you are running in windows xp?

  4. Nancy says:

    @robert

    If you install Cygwin on your Windows XP system (see cygwin.com) you’ll have all that you need (including Python) to run the scripts above. [I just discovered this -- won't tell you how long I've been looking for something I could script locally. Thanks, folks.]

Respond

Comments

Comments

retaggr