Skip to content. | Skip to navigation

Sections
Personal tools

4. Mailman

4. Mailman

used for a-muse, installed via ports collection. Documentation from list.org and exim.org. The real documentation can be found at /usr/ports/mail/mailman/work/mailman-2.1.1/ ,though, especially INSTALL and README.EXIM.

4.1. Installing Mailman

cd /usr/ports/mail/mailman
make MAIL_GID=mail
make install
su - 
cd /usr/local/mailman/ 
./bin/check_perms
./bin/check_perms -f

now set up apache. Add to httpd.conf:

Alias /pipermail/ /usr/local/mailman/archives/public/
ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"

copy the icons to /usr/local/www/data/icons

now set up exim. Add the following to the MAIN CONFIGURATION SETTINGS section of /usr/local/etc/exim/configure (usually as last entry, just before the ACL section):

# Home dir for your Mailman installation -- aka Mailman's prefix # directory. 
MAILMAN_HOME=/usr/local/mailman
MAILMAN_WRAP=MAILMAN_HOME/mail/mailman 
# User and group for Mailman, should match your --with-mail-gid # switch to Mailman's configure script. 
MAILMAN_USER=mailman 
MAILMAN_GROUP=mail

Note

MAILMAN_USER means the user under which mailman is installed (i.e. mailman) and MAILMAN_GROUP the group under which the MTA runs (i.e. mailnull) and of which mailman should also be a member. Duh!

to the routers section:

mailman_router: driver = accept require_files =
        MAILMAN_HOME/lists/$local_part/config.pck local_part_suffix_optional
        local_part_suffix = -bounces : -bounces+* : \ -confirm+* : -join :
        -leave : \ -owner : -request : -admin transport = mailman_transport

Note

in case the domain of your list is not covered in local_domains you must add a domains = list.domain.tld to the mailman router section

to the transports section:

mailman_transport: driver = pipe command =
        MAILMAN_WRAP \ '${if def:local_part_suffix \
        {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \ {post}}' \
        $local_part current_directory = MAILMAN_HOME home_directory =
        MAILMAN_HOME user = MAILMAN_USER group = MAILMAN_GROUP

Note

Now is a good time to test your exim/configure file: exim -C /usr/local/etc/exim/configure -bV

Before starting the Mailman qrunner daemon, you must create the mailing list mailman by executing the following from the $prefix/bin directory: % bin/create mailman and then start up qrunner ./mailman_ctl start. Rename /usr/local/etc/rcd/mailman.sh-dist to start it up on reboot.

4.2. securing Mailman with https

To make the Mailman webinterface work with https the following steps need to be performed:

  • set up VirtualHost with https

  • make changes to Mailman/mm_cfg.py

  • fix urls of each installed list

4.2.1. Virtual Hosts for Webinterface

Add the following VirtualHost entries to httpd.conf

<VirtualHost lists.tomster.org:80>
    ServerAdmin mailman-admin@tomster.org
    DocumentRoot /usr/local/mailman/cgi-bin
    ServerName lists.tomster.org
    ServerAlias lists.klingendes-museum.de
    ServerAlias ds80-237-202-128.dedicated.hosteurope.de
    Redirect /mailman "https://lists.tomster.org/mailman/"
</VirtualHost>

<VirtualHost lists.tomster.org:443>
    ServerAdmin mailman-admin@tomster.org
    DocumentRoot /usr/local/mailman/cgi-bin
    ServerName lists.tomster.org
    ServerAlias lists.klingendes-museum.de
    SSLEngine On
    SSLCertificateFile /usr/local/etc/apache/certs/lists.tomster.org/ssl.crt/server.crt
    SSLCertificateKeyFile /usr/local/etc/apache/certs/lists.tomster.org/ssl.key/server.key


    # For Mailman
    Alias /pipermail/ /usr/local/mailman/archives/public/
    ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"

</VirtualHost>

The first entry defines the non-ssl host with a forced redirect to the ssl-version. See also ???

4.2.2. Mailman configuration

Since all links and form submits on the Mailman configuration pages are absolute links including the http prefix, you need to change that globally if you want to run the admin interface via SSL. This is done in Mailman/mm_cfg.py where you can modify the default URL pattern:

##################################################
# Put YOUR site-specific settings below this line.
DEFAULT_EMAIL_HOST = 'lists.tomster.org'
DEFAULT_URL_HOST = 'lists.tomster.org'
DEFAULT_URL_PATTERN = 'https://%s/mailman/'
VIRTUAL_HOST_OVERVIEW = No
add_virtualhost('lists.klingendes-museum.de', 'lists.klingendes-museum.de')

In order for this to take effect, the .py script needs to be compiled. This happens automatically after restarting qrunner:

cd /usr/local/mailman
 ./bin/mailmanctl restart

4.2.3. Fixing the lists

For each list to use this new prefix you need to run fix_url for each of them:

./bin/withlist -l -r fix_url <listname>

4.3. Setting up subdomains

I like to run mailinglists on separate domains to keep things clean. This does require some extra effort, though. First, you (obviously) need to set up the subdomain in your zonefile (we're using bind here):

lists.tomster.org.      A       80.237.202.128
                        MX      10      mail.tomster.org.

Note

Don't use a CNAME entry for the MX record. Bad idea! I found that out the hard way...

Then you must tell exim, that it's responsible for that subdomain (see also above and don't forget to reload exim)

domainlist local_domains = [...] lists.tomster.org : [...]

Now you can add mailingslists for this domain. To give public mailinglists a 'pretty' name you can add an entry to the forwardtable of exim. In that case, you must add that address to the list of valid aliases for that mailing list.

Note

This isn't really all necessary. It's just the way I do things. You could be well enough off with just using your main domain...

4.4. Administrating Mailman

The Mailman listserver is controlled mainly through a couple of (locally executed) perl scripts and the web interface which is located in /usr/local/mailman/cgi-bin. The following apache httpd.conf directive serves the admin pages under the URL https://lists.tomster.org/mailman/admin:

    # For Mailman
    Alias /pipermail/ /usr/local/mailman/archives/public/
[...]
    # for Mailman
    ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"
[...]

<VirtualHost 80.237.202.128>
    ServerAdmin mailman-admin@tomster.org
    DocumentRoot /usr/local/mailman/cgi-bin
    ServerName lists.tomster.org
 </VirtualHost>

Note

you should use the https version of the admin links, whenever possible!

Check out the following documentation for managing Mailman: GNU Mailman List Management Guide v 2.0.

4.4.1. adding / creating a mailinglist

Create the list using the newlist command:

su
cd /usr/local/mailman
./bin/newlist -l de listname@lists.domain.tld listadmin-addr admin-passwd

If necessary add lists.domain.tld to the domainlist local_domains directive in /usr/local/etc/exim/configure (and restart exim).

Note

I've had problems with lists generated through the web: welcome messages to newly (mass-)subscribed users wouldn't get sent out. I can't really reproduce it, but for the time being, I strictly create new lists through the command line. It works.

4.5. Mailinglist types

Mailman generally assumes, that you want to run an open, all-equal mailing list, i.e. where everybody can join and everybody receives all postings. However, this may not be what you want. Other options could be a newsletter, where only moderators may post but not members. Or a hotline type of list, where the public may post, but only members may read the postings.

4.5.1. Newsletter

Rules: only moderators may post. Subscription is open. This type is actually not explicitely supported by Mailman (it was designed for true, geeky two-way communication and not to deliver press-statements ;-) However, it's an excellent delivery tool for newsletters.

The 'trick' here is to

  • set the default_member_moderation to 'yes' before adding any subscribers

  • turn off welcome messages

  • set the reply-to to 'sender' or 'explicit' (but obviously not to 'list', since everything would bounce!)

  • use the mass import feature to import your subscribers

4.5.2. Hotline

Rules: only subscribers may read postings, general public may post. Subscription is closed.

This is easy. Simply enter the following wildcard in the Privacy options -> [Sender filters] -> List of non-member addresses whose postings should be automatically accepted: ^.*. (The caret signals the beginning of a regular expression.)

For publicly writeable lists you may also want to deactivate the spam protection feature require_explicit_destination. Especially, if you have forwarders from non-list addresses (i.e. is forwarded to )

4.5.3. Marketplace

This is the most "natural" type of mailing list for Mailman. All members are allowed to post, subscription is closed (i.e. requires approval). Reply-to is set to sender, however.

Outdated Information
Please note that most of the information contained in this section is several years old and while most of it is still useful, hardly none of it applies directly to current versions of the software discussed. Proceed with caution, your mileage may vary etc. pp. ;-)