Mailman Tips, Tricks, Scripts

Mailman is an easy to maintain mailing list manager written in Python.

Email Confirmations

Handling moderator confirmations via Email can be simplified by scripting your mail program to generate and mail the proper response and then delete the moderation notice.


For mutt I use a keyboard macro to reply to the confirmation mail.

# confirm Mailman messages
macro index X ':set fast_reply=yes^M:set editor="touch %s"^M\
v/confirm ^Mrf^A^K^Myqd:reset fast_reply^M:set editor="jed %s -f mail_mode"^M'
macro pager X ':set fast_reply=yes^M:set editor="touch %s"^M\
v/confirm ^Mrf^A^K^Myqd:reset fast_reply^M:set editor="jed %s -f mail_mode"^M'

Apple OS X is easy to script using AppleScript. You can select one or more messages and then use this script to cancel (or approve) each of them. Mailman Cancel.applescript

Through the Web

Effective Mailman administration really presumes shell access so that you can use the many tools available in the 'bin' directory for maintaining your lists. However if that is not allowed by your host, you can script the web interface using a local copy of Python to mimic what a human user would do with a web browser. Unfortunately, it is difficult to capture all of the possible failure modes so this approach is rather fragile, and can be slow.


fetch subscriber Email addresses
use the web interface to get a list of subscribers for host, listname, and list password specified on the command line (requires Python 2.4's cookielib or ClientCookie)
  • 2010-01-29 add explicit GPLv2 license
  • 2005-06-14 check for roster pages starting with digits
  • 2005-06-04 add --nomail switch (Mark Sapiro)
  • 2005-02-27 only visit roster pages with letters that exist
  • 2005-02-16 updated to use Python 2.4's cookielib, and fall back to requiring ClientCookie if it is unavailable
  • 2005-02-15 updated to work with ClientCookie 0.4.9 or 1.0.2
"unhide" a list of subscribers
clear the "hide" flag on a list of subscribers, using Python's urllib module to manipulate the web interface


A small Python script can generate a route map for all of the lists in a Mailman instance. (Although there is rarely any point letting the messages make it that far into your MTA if you aren't planning to handle all of them.)

List Inclusion

A couple of people on the Mailman-Users mailing list have requested the ability to allow membership in one list to allow posting to a second list. A lightly tested change is available for Mailman 2.1.6 (and 2.1.5) that allows you to specify '@listb' in lista's accept_these_nonmembers.