mlmmj is a nice, clean mailing list manager. Postfix setup on Gentoo is pretty easy, following the Postfix README. The following assumes you've already got Postfix working.

Setup

Install mlmmj:

# emerge -av mlmmj

Add a mlmmj user, so the list doesn't have to run with root permissions:

# useradd -rmd /dev/null -s /sbin/nologin mlmmj

Make a spool directory:

# mkdir /var/spool/mlmmj
# chown mlmmj.mlmmj /var/spool/mlmmj

Create a mailing list (e.g. mlmmj-test):

# sudo mlmmj-make-ml.sh -c mlmmj:mlmmj -L mlmmj-test

Use a transport map so Postfix can invoke the mlmmj executables as the mlmmj user. In /etc/postfix/main.cf:

virtual_alias_maps = hash:/etc/postfix/virtual
transport_maps = hash:/etc/postfix/transport
mlmmj_destination_recipient_limit = 1

In /etc/postfix/virtual, add a line for each mailing list.

mlmmj-test@example.com    example.com--mlmmj-text@localhost.mlmmj

In /etc/postfix/transport, add a line for each mailing list. The following line maps the virtual address (example.com--mlmmj-test@localhost.mlmmj) to a transport (mlmmj) with a given nexthop address (mlmmj-test):

example.com--mlmmj-test@localhost.mlmmj        mlmmj:mlmmj-test

Add the referenced transport to /etc/postfix/master.cf:

mlmmj   unix  -       n       n       -       -       pipe
  flags=DORhu user=mlmmj argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/$nexthop/

The flags are:

  • D - Prepend a 'Delivered-To: recipient' header
  • O - Prepend an 'X-Original-To: recipient' header
  • R - Prepend a 'Return-Path:'. header
  • h - fold $nexthop to lowercase
  • u - fold $recipient to lowercase

Restart Postfix:

# /etc/init.d/postfix restart

Add the maintenance daemon (which will drop permissions automatically) to the root crontab:

0 */2 * * *  /usr/bin/mlmmj-maintd -F -d /var/spool/mlmmj

Configuring the list

Set custom headers:

# cat /var/spool/mlmmj/mlmmj-test/control/customheaders
X-Mailinglist: mlmmj-test
Reply-To: mlmmj-test@example.com

Set custom footers:

# cat /var/spool/mlmmj/mlmmj-test/control/customfooters
-- 
To unsubscribe send a mail to mlmmj-test+unsubscribe@example.com

Set a subject prefix (e.g. Subject: [mlmmj-test] how are we doing?)

# echo '[mlmmj-test]' > /var/spool/mlmmj/mlmmj-test/control/prefix

Make a moderated list:

# touch /var/spool/mlmmj/mlmmj-test/control/moderated
# echo 'jack@example.com > /var/spool/mlmmj/mlmmj-test/control/moderators
# echo 'jill@example.com >> /var/spool/mlmmj/mlmmj-test/control/moderators

Command line maintenance

Subscribe users:

# mlmmj-sub -L /var/spool/mlmmj/mlmmj-test/ -a jdoe@example.com

Unsubscribe users:

# mlmmj-unsub -L /var/spool/mlmmj/mlmmj-test/ -a jdoe@example.com

See the other mlmmj-* utilities for more goodies.

Email interface

In the following, listname should be replaced by the name of the list. For example, mlmmj-test from the examples above.

  • Send mail to the list at listname@example.com
  • Send off-list mail to the list owner at listname+owner@example.com
  • Send off-list mail to the list moderators at listname+moderators@example.com
  • Subscribe with an empty email to listname+subscribe@example.com
  • Unsubscribe with an empty email to listname+unsubscribe@example.com
  • Get help on other features of mlmmj by sending an empty email to listname+help@example.com.