Running a mailing list with Mailman

Posted by Steve on Wed 9 Mar 2005 at 16:11

Tags: ,

Mailing lists are good for achiving discussion when you have no idea in advance how many people might be interested - because there's no real limit to the number of members. They're also good for preserving history as the messages can be archived easily and made searchable on the web.

Whilst there are many mailing list managers available inside Debian one of the most popular is GNU Mailman, it is used for many mailing lists around the world and it is well suited for use with the mail transfer agent used in Debian, exim or exim4 by default.

One of the attractions of using mailman is that it offers a simple means to archive the messages built in, these can be placed upon the internet easily and automatically if your mailing list server is running a webserver.

To install mailman you should run, as root:

apt-get install mailman

This will download and install the package and any missing dependencies for you.

Installing On Debian's Unstable or Testing branches

When you install on the Unstable or Testing branch of Debian you will install a more recent version than that which is included in Debian's Woody release. Because of that the installation is not complete until you perform a couple of additional steps.

When the package installs it will ask you to choose the languages it should enable. You can merely accept the default of en if you're not discussing things in additional languages, this is the default.

You'll also be prompted to create a mailman specific list, do that by following the instructions given to you, run the following command:

newlist mailman

Answer the questions it asks you and when it is finished it will give you this output:

## mailman mailing list
mailman:              "|/var/lib/mailman/mail/mailman post mailman"
mailman-admin:        "|/var/lib/mailman/mail/mailman admin mailman"
mailman-bounces:      "|/var/lib/mailman/mail/mailman bounces mailman"
mailman-confirm:      "|/var/lib/mailman/mail/mailman confirm mailman"
mailman-join:         "|/var/lib/mailman/mail/mailman join mailman"
mailman-leave:        "|/var/lib/mailman/mail/mailman leave mailman"
mailman-owner:        "|/var/lib/mailman/mail/mailman owner mailman"
mailman-request:      "|/var/lib/mailman/mail/mailman request mailman"
mailman-subscribe:    "|/var/lib/mailman/mail/mailman subscribe mailman"
mailman-unsubscribe:  "|/var/lib/mailman/mail/mailman unsubscribe mailman"

These lines should be added to the end of the system alias file you have /etc/alias. Once you've added them you should run the following command to regenerate the binary aliases file:

newaliases

Finally you need to start the mailman daemon, you do that by running:

/etc/init.d/mailman start

Once these things have been done the software is installed as it would have been under Woody, and you can now follow on as normal.

The next step is to configure the mailing lists you wish to use, and make sure they are archived to the internet. Both of these things are simple to arrange.

To create new mailing lists there are two steps:

  • Create the list data within mailman
  • Hookup the mail delivery agent you're using to deliver to mailman

To start the process lets imagine we're going to create a new mailing list to discuss sheep, run the following command to setup mailman for the list:

newlist sheep

This will create a bunch of mail aliases and output them for you - to hook them up to your mail delivery agent you must add them to the system aliases file, /etc/aliases.

The lines generated will look like this:

## sheep mailing list
sheep:              "|/var/lib/mailman/mail/mailman post sheep"
sheep-admin:        "|/var/lib/mailman/mail/mailman admin sheep"
sheep-bounces:      "|/var/lib/mailman/mail/mailman bounces sheep"
sheep-confirm:      "|/var/lib/mailman/mail/mailman confirm sheep"
sheep-join:         "|/var/lib/mailman/mail/mailman join sheep"
sheep-leave:        "|/var/lib/mailman/mail/mailman leave sheep"
sheep-owner:        "|/var/lib/mailman/mail/mailman owner sheep"
sheep-request:      "|/var/lib/mailman/mail/mailman request sheep"
sheep-subscribe:    "|/var/lib/mailman/mail/mailman subscribe sheep"
sheep-unsubscribe:  "|/var/lib/mailman/mail/mailman unsubscribe sheep"

These lines are in a fairly simple format, the thing to the left of the ":" seperator are addresses, eg "sheep@yourdomain.com", "sheep-subscribe@yourdomain.com". The bit after the colon is a program to run when a mail is sent to that address.

To make the alias changes live you must regenerate the file by running:

newaliases

This should be sufficient to wire up your new mailing list.

To test it you should try sending a mail to "sheep@yourdoamin.com", if all goes well you will not recieve an error and people on the list (none yet!) will all receive a copy.

If this proceeded without error you can now make sure that your mail is being archived correctly. Mailman will integrate itself into your webserver if you're running Apache or Apache2

For example you can view the mailing list page that describes your new sheep list by visiting the following URL:

http://example.com/cgi-bin/mailman/listinfo/sheep

The archives will not be setup properly yet, to do that you should add the following two lines to the bottom of your apache configuration file:

Alias /pipermail/ /var/lib/mailman/archives/public/
Alias /images/mailman/ /usr/share/images/mailman/

Once you do that and restart your webserver you can view the archive pages for your new list by visiting the following URL:

http://example.com/pipermail/sheep/

Users can add and remove themselves to the list by visiting the webpages and entering their email address, or by sending a message to the addresses:

sheep-subscribe@example.com      # Add themselves
sheep-unsubscribe@example.com    # Remove themselves
Share/Save/Bookmark


Posted by Serge (213.119.xx.xx) on Wed 9 Mar 2005 at 19:33
[ Send Message | View Serge's Scratchpad | View Weblogs ]
It's also possible to dedicate a separate domain to mailman, if you can provide one. Easy to setup when using postfix as MTA, here is one quick hack, might not be complete:
add this to /etc/postfix/master.cf:
mailman unix  -       n       n       -       -       pipe
flags=FR user=list
argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
and issue these statements:
postconf -e transport_maps=hash:/etc/postfix/transport
echo "lists.domain.com mailman:" >> /etc/postfix/transport
postconf -e relay_domains=/etc/postfix/relay_domains
echo "lists.domain.com" >> /etc/postfix/relay_domains

--

Serge van Ginderachter

[ Parent | Reply to this comment ]

Posted by Anonymous (81.86.xx.xx) on Wed 9 Mar 2005 at 22:21
Its possible to configure Exim so you don't need to add the aliases.

See http://www.exim.org/howto/mailman21.html for lots of cool things to do with Exim & Mailman.

[ Parent | Reply to this comment ]

Posted by mel (205.238.xx.xx) on Tue 10 Jan 2006 at 22:13
[ Send Message ]
I need some help with Debian, mailman and Exim4

have the latest installed using apt-get

have mailman working
Exim is routing mail in to proper boxes and mail lists

when I create a list, the list owner gets the email

when email is sent to a list, it goes to the moderator, and is accepted, but never goes out to the list?

I setup crontab
have been following all the FAQ's I can find.

what am I missing?

mel

[ Parent | Reply to this comment ]

Posted by chris (80.202.xx.xx) on Fri 20 May 2005 at 20:14
[ Send Message | View Weblogs ]
Good starter article. Now - how about one on migrating a mailman 2.0 install (together with all old archives) from a woody box to mailman 2.1 on sarge? I'm dreading this step :)

[ Parent | Reply to this comment ]

Posted by ineiti (81.221.xx.xx) on Tue 19 Jul 2005 at 20:52
[ Send Message ]
Hi,

I'm on the edge of desperation (well, nearly): For a reason unknown to me, apache2 (debian sarge) doesn't want to accept the executables of the mailman-dir. If I rename the "admin" to "admin.cgi", then it works (well, it gives another error, but at least it runs the file). I had it running under apache 1.x, but with apache2 it just doesn't work... Any idea how to tell Apache to run everything in the directory? For the moment I have:

Alias /cgi-bin/ /usr/lib/cgi-bin/
< Directory "/usr/lib/cgi-bin" >
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
< /Directory >

which seems fine to me...

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 19 Jul 2005 at 22:17
[ Send Message | View Steve's Scratchpad | View Weblogs ]

I have the following setup in my VirtualHost - but I don't see anything drastically different to your setup:

ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/
        ScriptAlias /cgi-bin/ /home/www/www.shellcode.org/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>

<Directory /usr/lib/cgi-bin/mailman/>
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
Alias /pipermail/ /var/lib/mailman/archives/public/
<Directory /var/lib/mailman/archives/public>
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Alias /mmimages/ /usr/share/doc/mailman/images/
<Directory /usr/share/doc/mailman/images>
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by ineiti (81.221.xx.xx) on Wed 20 Jul 2005 at 14:49
[ Send Message ]
Aargh, I'll never do any administrative task again after 10 o'clock in the evening. It's just too nerve-breaking. After:
  • Installing a sarge in chroot, testing apache2 and mailman
  • Comparing with my installation, enabling one site after another
I discoverd that the magic word is ScriptAlias ! Well, so much for administration after a long day. Shouldn't be done, it's not worth it ;)
So the lines should look like this:
ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/ 
 < Directory "/usr/lib/cgi-bin/mailman" > 
 AllowOverride None 
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
 Order allow,deny 
 Allow from all 
 < /Directory > 

Thanks anyway,
Ineiti
PS: I hate this feeling of KNOWING it's a stupid mistake and that I'll feel so bad...

[ Parent | Reply to this comment ]

Posted by ineiti (81.221.xx.xx) on Wed 20 Jul 2005 at 16:02
[ Send Message ]
Well, that doesn't work, neither. Mailman thinks it's in /cgi-bin/mailman, so the ScriptAlias must be:

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

And I couldn't get it running using /etc/aliases, at least not with exim4. I had to use the steps in /usr/share/doc/mailman/README.EXIM.gz

Well, it works now. Only 4 hours to move a mailing-list from one server to another. I think I'm gonna buy a Windows. Then at least I can blame somebody else ;)

Ineiti

[ Parent | Reply to this comment ]

Posted by kick (84.9.xx.xx) on Wed 5 Oct 2005 at 20:00
[ Send Message ]
Hi ppl,
anyone know how i fix this?
im using debian sarge on a 2.6.8-2-386 kernel exim4 and apache2
the admin login screen works and so does the subscription page,

im getting subscription notifications and unsubscribe's but no posts are getting through :(
there are a few config files on exim4 ..does anyone know which one i should edit?

thanks in advance :)


email=
The address to which the message has not yet been delivered is:

pipe to |/var/lib/mailman/mail/mailman post **********
generated by ********@********
Delay reason: pipe_transport unset in system_aliases router

No action is required on your part. Delivery attempts will continue for
some time, and this warning may be repeated at intervals if the message
remains undelivered. Eventually the mail delivery software will give up,
and when that happens, the message will be returned to you.


[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Thu 6 Oct 2005 at 12:35
[ Send Message | View Steve's Scratchpad | View Weblogs ]

As the parent says read and follow the instructions in /usr/share/doc/mailman/README.EXIM.gz.

Steve
--

[ Parent | Reply to this comment ]

Posted by Anonymous (64.184.xx.xx) on Thu 8 Feb 2007 at 10:48
In your virtual_alias_map file(s) you can create a virtual email address that points to an off-site email address. Postfix will glady accept emails sent to the virtual address whether the real email address is valid or not.
IE. greg@mydomain greg_bad_address@yahoo.com

So we should be able to setup an entry in our virtual_alias_map (virtusers for sendmail converts) to point the pretty name of our mailing list to the entry in the aliases file.

You can simply add a virtual_alias_map entries like these:

mylistsname@somelocaldomain listname
mylistsname-admin@somelocaldomain listname-admin
mylistname-bounces@somelocaldomain mylistname-bounces

etc. etc.

If you want to do all the email based subscription/administration you'd have to create an entry in /etc/postfix/virtual-domains for each entry in aliases that mailman has generated.


G

[ Parent | Reply to this comment ]

Posted by mtodorov_69 (161.53.xx.xx) on Wed 18 Apr 2007 at 08:58
[ Send Message ]
If one is a nostalgic guy trying to run mailman with sendmail, there will be an error:

----- The following addresses had permanent fatal errors -----
"|/var/lib/mailman/mail/mailman post list"
(reason: Service unavailable)
(expanded from: <list@domac.alu.hr>)

----- Transcript of session follows -----
smrsh: "mailman" not available for sendmail programs (stat failed)
554 5.0.0 Service unavailable

The cure is described on http://www.gnu.org/software/mailman/mailman-install/node32.html

Smrsh is sendmail's restricted program runner, and on my Debian sarge box it has list of lawful programs in /etc/mail/smrsh:

mtodorov@domac:~/mailman/mailman-2.1.9/contrib$ ls -l /etc/mail/smrsh
total 0
lrwxrwxrwx 1 root root 26 Apr 20 2005 mail.local -> /usr/lib/sm.bin/mail.local
lrwxrwxrwx 1 root root 17 Apr 20 2005 procmail -> /usr/bin/procmail
mtodorov@domac:~/mailman/mailman-2.1.9/contrib$

Simply add a (symbolic) link there to wherever your mailman alias in /etc/mail/aliases points to. The path to mailman binary may differ (start with /usr/lib or /var/lib, but it appears to lead to exactly the same inode (verified with stat (2) or ``ls -il'').

Hope this helps.

[ Parent | Reply to this comment ]

Posted by Anonymous (217.18.xx.xx) on Wed 3 Sep 2008 at 15:25
Command died with status 2:
"/var/lib/mailman/mail/mailman post sheet". Command output: Group mismatch
error. Mailman expected the mail wrapper script to be executed as group
"daemon", but the system's mail server executed the mail script as group
"nobody". Try tweaking the mail server to run the script as group
"daemon", or re-run configure, providing the command line option
`--with-mail-gid=nobody'.

How to fix this?

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Flattr

Quick Site Search