Export Mailman Subscriber Address Lists Without SSH/Shell Access

I recently had a need to export the contents of a GNU Mailman-based mailing list for WordCamp Philly, so I poked around the web-based Mailman admin interface, hoping to find an easy way to export a .CSV or at least a list of names, to no avail. The only supported, native way is to use a couple of Mailman shell scripts from the command line. Alas, since this particular list is hosted on a shared hosting account, I lacked the proper access to pursue this route.

There are a few ways to get around this, but they involve

  1. overly-complicated internal Mailman commands emailed directly to the listserv WITH THE ADMIN PASSWORD CONTAINED IN THE EMAIL ITSELF or
  2. use of third-party Python scripts with external dependencies or
  3. cutting-and-pasting by hand.

Perhaps you heard that laughter from where you sit? That was me. Laughing maniacally at those “solutions”.

I needed simple, I needed quick, so after a bit of Google scouting, I came across the following (ever-so-slightly modified/generalized):

wget -O - --post-data 'adminpw=${admin password}'  http://${listserv domain name}/admin.cgi/${list name}/members | egrep "_realname" | sed 's/^.*value="\([^"]*\)".*value="\([^"]*\)".*$/\1,\2/' | sed 's/%40/@/' > maillist.csv

This single-liner should work on any Linux/Mac/BSD/etc. box with a decently up-to-date version of wget installed on it and it should dump a nice comma-separated list into a file, maillist.csv. Let’s break it down a bit so that you can see how it’s working its magic.

wget -O - --post-data 'adminpw=${admin password}'  http://${listserv domain name}/admin.cgi/${list name}/members

Here, ${admin password} is the actual Mailman list admin password, ${listserv domain name} is your actual Mailman server’s DNS name (in my case, it was lists.phillywp.org, but yours will obviously differ) and ${list name} is the actual list slug.

NOTE: Some Mailman setups have pretty URLs turned on, in which case you may need to use admin/ instead of admin.cgi. The fastest way to determine the proper URL is to simply visit your Mailman list admin page and take note of the full URL.

This portion of the code retrieves the contents of the ${list name}‘s membership list by essentially screen-scraping the entire page. This is a step in the right direction, but obviously not very human-readable. The output is littered with HTML output that makes picking the subscribers’ needles out of that particular haystack a bit of a chore. The next two bits help on that count.

| egrep "_realname"

This bit strips all lines except those containing the subscribers’ real names. Again, useful, but still a bit too much info for our purposes.

| sed 's/^.*value="\([^"]*\)".*value="\([^"]*\)".*$/\1,\2/'

Here we look for two values contained in the line, specifically the subscriber’s real name and email address. We then output those two values as essentially Real Name, email Address.

| sed 's/%40/@/'

There’s one small problem with the comma-separated values we exported in the step above — the @ symbol is actually encoded as an HTML entity, namely %40. By running that sed, you’re changing %40 into the universally-understood @

So, when all is said and done, you should have a nice, concise, comma-delimited text file containing a complete list of your Mailman subscribers, one per line. I hope someone else finds this to be as time-saving a proposition as I did.


Hi I am using Elbee Elgee 1.3.1. I really like this template above all the other Buddypress themes so please help. I am using a custom header and I do not want that shadow on the left side… also I checked the box not to show text in header but it is still there. How can I fix this?

    Do you have a link to your site you can share with me? I’d like to take a look and make a couple of recommendations.

        A few things that will make your theme experience cleaner.

        Under Appearance -> Menus, Elbee Elgee should have created a menu containing your BuddyPress page links. Assign it to the “Default BuddyPress Menu” location. Don’t forget to hit “Save”!
        Again under Appearance -> Menus, create a default navigation menu and assign it to the “Primary Navigation Menu” location.
        Open up wp-content/themes/elbee-elgee/styles/ng.css in your favorite editor. Go to line 55 — it should read div#titledesc {. Replace everything between that and the next } with display: none;

        In other words, instead of

        div#titledesc {
        width: 50%;
        height: 100%;
        float: left;
        vertical-align: bottom;

        it should simply read

        div#titledesc {
        display: none;

        Does that make sense?

        The checkbox not forcing the text to be hidden is a bug that I will need to fix but the solution I outlined should do in the meantime.

          Hey. I did this and it worked. BUT. It also deleted the title name – so I have now to design a header with name in it? Or is there another way as well that leaves the text?

Leave a Reply

Name and email address are required. Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 

Literal Barrage is Stephen Fry proof thanks to caching by WP Super Cache