Mailman 2.1: Powerful E-mail List Management Software

—by David O’Donnell, atropos@afp548.com

29 January 2003 — Updated 21 March 2003

One of the most popular services you can offer users is hosting e-mail distribution lists, also known simply as “lists” or “listservs” (though the latter term is technically inaccurate, since Revised LISTSERV is not the only mailing list software on the Internet). Mailman is one of the several list management software packages available, and stands out for being free, easy to use, and very powerful. I covered installing Mailman 2.0.x in this article.

Mailman 2.1 is a significant upgrade to the software package. I will cover it in two articles: installing Mailman 2.1 as a new package, and upgrading from Mailman 2.0.x. If you currently run Mailman 2.0, I recommend using the upgrade instructions, as they involve the least amount of inconvenience for yourself and your list users.

In order to use Mailman, you will need four things:

  1. Apple’s Developer Tools (install the latest package from Developer Connection.)
  2. Python 2.2 or greater (which comes with Mac OS X 10.2; if you are using Mac OS X 10.1.x, please see my earlier article on Mailman 2.0.x for directions on obtaining and installing Python 2.2)
  3. An active Web server that can be reached, either from the Internet or on an Intranet, depending on your audience.
  4. An active mail server that can be reached (in the same scope as your Web server), and which can handle UNIX-style aliases. In short, most any mail server (except Apple Mail Service) that can run on Mac OS X. I recommend Postfix, mainly because I use it.

Mailman interacts with its users via the Web and e-mail, so it is critical that you have both services active and configured properly.

Mailman requires a separate user and group to function. This isolates it from other system services, and provides a layer of security. You can create the Mailman user and group either in Workgroup Manager or by the following command-line commands:

sudo tcsh
niutil -create / /users/mailman
niutil -createprop / /users/mailman name mailman
niutil -createprop / /users/mailman uid 12345
     (note: use any userID not already taken on your system; use NetInfo Manager or
      Workgroup Manager to see which userIDs are in use)
niutil -createprop / /users/mailman home /usr/local/mailman
mkdir -p /usr/local/mailman
niutil -createprop / /users/mailman shell /bin/tcsh
passwd mailman
     (to prevent malicious hacking, supply a secure password here)
niutil -create / /groups/mailman
niutil -createprop / /groups/mailman name mailman
niutil -createprop / /groups/mailman gid 12345
     (note: choose any groupID not already in use on your system. I chose the same 
      number for ease of remembering)
niutil -createprop / /groups/mailman passwd '*'
niutil -createprop / /groups/mailman users 'mailman'
chown mailman:mailman /usr/local/mailman
cd /usr/local/mailman
chmod a+rx,g+ws .
exit
su - mailman

Now, retrieve Mailman’s source package and uncompress it in mailman’s home directory:

wget http://www.list.org/mailman.tar.gz
gunzip mailman.tar.gz
tar xvf mailman.tar
cd mailman-2.1

The next step requires you to know information about your Web server and mail service. Mailman needs to know the groupID for both services. Web service runs under group www, but mail service will depend on your MTA. For example, Postfix likes to run in group nobody. If you aren’t sure which group your MTA uses, try nobody. Once you have Mailman running, you can tail the mail.log to see if you have the wrong group. If so, make a note of what Mailman wants and then (as user mailman, in /usr/local/mailman/mailman-2.1) execute the command “make clean” and then execute the command below. You will execute this command once you know what mail groupID is needed, regardless:

./configure --with-mail-gid=mailgid --with-cgi-gid=www

The configuration process will take a minute or two, depending on the speed of your machine. By the way, don’t be upset if you choose the wrong mail gid; it is possibly the number one mistake made when building Mailman.

Once configuration is complete, you will need switch to the root user to install Mailman. Technically, this should not be necessary; however, it has been my experience that you cannot install Mailman as the mailman user under Mac OS X.

exit
sudo tcsh
cd ~mailman/mailman-2.1
make install

You should not experience any catastrophic errors while the make install process runs. If you do, check to make sure you have installed the latest Developer Tools from Apple, and that you haven’t installed any third-party tools that might interfere with the process.

Once Mailman is installed, you need to check permissions. It’s unlikely that this will run without error the first time, so follow the steps below (as root):

cd ~mailman
bin/check_perms
bin/check_perms -f

At this point, you have Mailman installed. Now you need to configure your Web server to interface with it. Mac OS X ships with Apache preinstalled, so the directions that follow are designed for that Web server.

Open /etc/httpd/httpd.conf in your favourite command-line editor and find the first instance of ScriptAlias. Insert the following line:

ScriptAlias /mailman/ /usr/local/mailman/cgi-bin/

Go back to the top of the file and search for the first instance of Alias. Add the following lines afterward:

Alias /pipermail/ /usr/local/mailman/archives/public/

<Directory “/usr/local/mailman/archives/public/">
   Options Indexes MultiViews FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

(Note that the Alias section is likely just before the ScriptAlias section, so you can also just scroll back a few lines to input the Alias instructions.)

Save the file and execute apachectl restart (you should still be root here!) to restart the Web server.

Mailman displays several logo images in its administrative interface. Copy these to your Web server’s default icons directory:

cp /usr/local/mailman/icons/*.{jpg,png} /usr/share/httpd/icons

Next in our sequence, we install Mailman’s timed scripts and start its daemons. Then, we will create a Startup Item so that Mailman will get launched every time you boot your Server.

cd ~mailman/cron
crontab -u mailman crontab.in
cd ..
bin/mailmanctl start

Before we can setup the StartupItem, you need to add the following line to /etc/hostconfig:

MAILMAN = -YES-

I’ve created a little StartupItem for Mailman, which you can download from here. To install it, place the file in /Library/StartupItems. As root, execute the commands

gunzip MailmanStartup.tar.gz
tar xvf MailmanStartup.tar

It will create the requisite directory and items therein.

The next stage in your configuration process will be either simple or complex. Mailman supports virtual domains for its e-mail lists. For example, you could run the list “foobar” on the site “baz.com” and the list “bash” on the site “fribble.net,” where both domains are virtual hosts run out of your computer, zippo.zappo.org.

To map support for your virtual domains, you need to add a line to /usr/local/mailman/Mailman/mm_cfg.py for each domain. The format is:

add_virtualhost(url_host, e-mail_host)

where url_host is the fully-qualified domain name used in the URL to Mailman on that virtual host (e.g., for http://www.baz.com/mailman/, the url_host would be www.baz.com) and e-mail_host is the MX record for the domain.

If you use Postfix as your MTA, you should now take a few minutes and read the README.POSTFIX file, located in /usr/local/mailman/mailman-2.1, for important information on integrating Mailman into your Postfix setup. There is a similar file for Exim users.

We’re almost done...

As site administrator, you will need a password that will give you control over every mailing list running on your Server, regardless of whether you are list owner or not. Set this password up with the command

~mailman/bin/mmsitepass yourpassword

Now, create a site-wide mailing list. This is where administrative password reminders will come from. Execute the command

~mailman/bin/newlist mailman

Follow the prompts, insert the aliases into your MTA (unless you’ve configured Mailman’s interaction to automatically do so, per README.POSTFIX or README.EXIM), and wait for the welcome e-mail to arrive. Follow the directions in it to look at your new list. Don’t forget to subscribe yourself!

At this point, you’re essentially done. You can configure various Mailman settings by reading the online help and the documentation (installed in the source directory). Mailman has a vigorous user community mailing list, which you can get to here:

http://mail.python.org/mailman/listinfo/mailman-users

Before posting questions or problems to that list, make sure you read the FAQ and search the list archives. This is good practice regardless, but the folks on the Mailman-Users list tend to be rather harsh with people who don’t exhaust other resources first.

Resources:

Mailman Web Site: http://www.list.org/
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Mailman Users Mailing List: http://mail.python.org/mailman/listinfo/mailman-users
Python Web site: http://www.python.org
Apache Web site: http://www.apache.org