Mailing Lists with Couriermlm

Courier not only is an excellent mail server, it also ships with a mailing
list manager that can be used to build mailing lists without relying on
a third party provider (which usually has the bad habit of adding
advertising text to the emails being forwarded).

Here’s a small tutorial that explains how to set up a new mailing list
using couriermlm.

I’m using a very simple Courier setup where email accounts are equivalent
to system users and are authenticated through authpam. If you
use Courier with user accounts authenticated against a MySQL database
or something else, you might have to do things differently.

1. Create a new User

You could theoretically create all mailing lists under a common system user
and use aliases to deliver email to the mailing list folders. I found it easier
to create a dedicated user account for each mailing list, however. This way,
I don’t have to modify
system-wide courier configuration files for each mailing list and all
informations and configuration belonging to a mailing list contained in the
dedicated user’s home directory.

Assuming you wanted to create a new mailing list called xyzzyx
to which users could post by sending emails to
xyzzyx@server.com, create a user account like this:

Notice that I haven’t allowed this user to login. One angle of attack less that
you need to worry about.

2. Create the Mailing List

To make sure the mailing list belongs to the right user, impersonate the user
when you set up the mailing list:

su --shell /bin/bash xyzzyx
cd ~

Now use the couriermlm tool to
create a new mailing list. I literally named the directory for the mailing list
"MailingList" because (as explained above) I’m using
a dedicated system user per mailing list, so this is the only mailing list that
will ever be on the user’s home directory.

In addition to receiving mail addressed user@domain, it is also possible for user
to receive mail addressed to user-foo@domain, for arbitrary values of foo.
To do this, install $HOME/.courier-foo, with delivery instructions for
mail addressed to user-foo@domain.

and

The file $HOME/.courier-foo-default specifies delivery instructions for
any user-foo-bar@domain address, where bar can be anything.
However, it does NOT control mail delivery to user-foo@domain, which
is controlled by $HOME/.courier-foo.

That’s it. Couriermlm also has a web interface that you can enable for
your users. You can also change or translate the templates for any
emails sent out by couriermlm (liike lost password lookups, bounce warnings,
subscription confirmations and more) by editing the .tmpl files
in the MailingList directory you created in step 2.