Topics for Mailman

by Juliet Kemp

Tip of the Trade: Juliet Kemp discovers and explores Topics in the mailing list server, Mailman. With Topics, subscribing to a list becomes more than an all or nothing proposition.

I discovered this week that Mailman has a topics facility. This means you can assign messages to a topic based on a regular expression and match the Subject and Keyword lines in every mail. Members of the mailing list can then subscribe only to particular topics of their choice, rather than to the list as a whole.

This is enabled in the Topics section of the mailing list admin pages. You can also set how many lines of the body are scanned for matches. Set this to 0 to scan only the Subject and Keyword lines. Set the name of the topic (e.g., "Networks"), then create your regular expression. Regexps here are case-insensitive, so there's no need to worry about capitalization. The most straightforward option is just to set a single word, for example,


which will filter any messages with 'networking' in the Subject line, the Keyword line, or the first 5 body lines into this "Networks" topic. Alternatively, you might want to try this:


which will match [networks]. You can, of course, get far more complicated than this if you want to, but I'll leave more comprehensive discussion of regexps to elsewhere!

If you want to use "or" filters, the online help implies that putting your various regexps on separate lines will do it:


Unfortunately, due to a bug in Mailman 2.1, this doesn't happen: What you need to do is to add the | (or) operator at the end of the line:


This will match on either 'networks' or 'networking'. You also need to escape whitespace with a backslash.

Once you have a couple of topics set up, list members can go to the member options page and choose the topics to which they wish to subscribe.

This can be an excellent solution for high-volume or multi-topic mailing lists. Do bear in mind, however, that it relies on members setting their Subject lines correctly (or mentioning the topic in the first few lines of the body), which is obviously susceptible to human error.

Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).

Follow ServerWatch on Twitter

This article was originally published on Monday Sep 21st 2009
Mobile Site | Full Site