Qmail+Vpopmail and Mailman

Nick Vargish

This Recipe is Probably Obsolete

I wrote this back in the dark ages, when Mailman did not support virtual domains. According to the bullet list of features at the Mailman home page, Mailman now supports virtual domains. I'm not sure when this support was added, but probably around 2.0 or 2.1. I strongly suggest you try using the latest version of Mailman, and investigating the native support for virtual mail domains, rather than following this recipe.

Mailman Into The Mix

If you want to add Mailman support to a qmail+vpopmail setup, there are a few things to be aware of, especially since you probably want each virtual domain to have their own Mailman setup. This is a quick guide that describes how I got things working, for most values of 'working'.

All examples, unless specified, assume you are setting up Mailman support for "foo.com". Where literal steps are presented, be sure to replace "foo" and "foo.com" references with appropriate values.

System Preparation

Once you've downloaded and unpacked the Mailman source code, you need to configure it. You will need to configure and install it for each virtual domain that will be using Mailman. You need to do this so that members@list.foo.com is a different list from members@list.bar.org. To avoid a lot of administrative overhead, you will need to create new mail domains for the Mailman lists. For example, if you want to add Mailman support to foo.com, you will be using the mail domain lists.foo.com.

This recipe assumes you will be using /home/mailman as the Mailman top-level directory. If you prefer, you can can use /var/mailman or any other directory. First, create the mailman user and directory:

useradd -d /home/mailman mailman
groupadd mailman
chgrp mailman /home/mailman
chmod a+rx,g+ws /home/mailman

The rest of the steps will need to be repeated for each domain that you want to support Mailman on.

Mailman Configuration

You will need to create a directory for each domain that will have Mailman lists:

mkdir /home/mailman/foo
chgrp mailman /home/mailman/foo
chmod a+rx,g+ws /home/mailman/foo
Now you need to configure and compile the mailman software. Some versions of Redhat require /usr/bin/python to be a specific version, which is why /usr/local/bin/python is specified:

./configure --prefix=/home/mailman/foo \
            --with-mail-gid=vchkpw \
            --with-cgi-gid=apache \

Build and install the software once the configure script is done.

Edit /home/mailman/foo/Mailman/mm_cfg.py. Add the following lines to the end of the file:

DEFAULT_EMAIL_HOST = 'lists.foo.com'
DEFAULT_URL_HOST = 'lists.foo.com'
add_virtualhost('lists.foo.com', 'lists.foo.com')

Set a password for list creation:

cd /home/mailman/foo

From the Mailman source directory, copy the qmail-to-mailman.py script into the mailman directory for foo.com:

cp /usr/local/src/mailman-2.1/contrib/qmail-to-mailman.py \
chown mailman.mailman /home/mailman/foo/qmail-to-mailman.py
chmod a+rx /home/mailman/foo/qmail-to-mailman.py

Edit qmail-to-mailman.py. At the top of the file, edit the two configuration variables:

MailmanHome = "/home/mailman/foo"; 
MailmanOwner = "postmaster@lists.foo.com";

Next, look for the line that looks like local = re.sub("^mailman-","",local). Change it to read:

    local = re.sub("^lists.foo.com-","",local)

Close your editor, making sure you've saved the script.

Next, you need to start the Mailman queue handler:

/home/mailman/foo/bin/mailmanctl start

Put in links so that the daemons will be started when the system is booted up:

cp /home/mailman/foo/scripts/mailman /etc/init.d/foo-mailman
ln -sf /etc/init.d/foo-mailman /etc/rc3.d/S97foo-mailman
ln -sf /etc/init.d/foo-mailman /etc/rc2.d/K97foo-mailman

And lastly, set up cron jobs for Mailman maintenance:

cd /home/mailman/foo/cron
crontab -u mailman -l > crontmp
cat crontab.in >> crontmp
crontab -u mailman contmp
rm crontmp

Qmail Configuration

Create a new virtual mail domain for lists.foo.com:

~vpopmail/bin/vadddomain lists.foo.com mailmanpass

Create a qmail-default file that will cause all mail to the domain to be handled by Mailman. Edit ~vpopmail/domains/lists.foo.com/.qmail-default and put this line in the file (remove the '\' character and put the whole thing on one line):

|/var/qmail/bin/preline /usr/local/bin/python \

That's all that should be needed by Qmail. You shouldn't even have to HUP the qmail-send process (vadddomain does that for you).

Apache Configuration

Here's a reasonable entry in your httpd.conf file:

# Mailman
<VirtualHost *>
   ServerName lists.foo.com

   ServerAdmin  postmaster
   DocumentRoot /home/mailman/foo
   Alias        /pipermail/ /home/mailman/foo/archives/public/
   ScriptAlias  /mailman/ /home/mailman/foo/cgi-bin/
   ErrorLog     /home/mailman/foo/logs/error_log

Stop and restart your apache server for the changes to take effect.

Last modified: 2004-April-2