Previous Section  < Day Day Up >  Next Section

Recipe 20.16. Creating a Mail List with couriermlm

20.16.1 Problem

You want to set up some mail lists on your Postfix/Courier mail server.

20.16.2 Solution

You'll need couriermlm (Courier mailing list manager), dot-courier, and cron.

Users can create a list in any directory where they have write permissions. You might want to set up list directories for your users outside of their home directories, for example in /var.

Run this command to create a directory for a new mailing list:

$ couriermlm create /var/lists/php_list  ADDRESS=php@test.net

This creates a directory chock-full of templates and subdirectories:

$ ls -xa php_list

.                     ..

adminrequest.tmpl     archive

bounces               commands

confsubj.tmpl         digestsubj.tmpl

fetch.tmpl            fetchsubj.tmpl

headeradd             help.tmpl

idxheader2html.tmpl   idxheaderhtml.tmpl

idxheadertxt.tmpl     idxsubject.tmpl

modqueue              modrejbody.tmpl

modreject.tmpl        modrejheader.tmpl

modsubject.tmpl       modtext.tmpl

modtext2.tmpl         options

sub.tmpl              sub2.tmpl

sub3.tmpl             sub4.tmpl

sub5.tmpl             sublist

subreportfooter.tmpl  subreporthdr.tmpl

subreporthdr1.tmpl    subreporthdr2.tmpl

subreporthdr3.tmpl    tmp

unsub.tmpl            unsub2.tmpl

unsub3.tmpl           unsublist

warn1headers.tmpl     warn1text.tmpl

warn1text2.tmpl       warn2msg.tmpl

Read the following template files, and edit them as necessary to suit your needs:


help.tmpl

The message that Courier sends in response to help requests.


sub.tmpl

Subscription is a two-step process, requiring confirmation to minimize bogus and forged subscriptions. sub.tmpl is the first reponse to a subscription request.


sub.tmpl

The final confirmation message, containing additional list instructions.


headeradd

Put any additional mail headers you want on list messages here.


headerdel

Put any mail headers you want deleted here.

If you're running a public list and don't want to expose subscribers' personal addresses to spammers, use headerdel and headeradd together:

# headerdel

Reply-To:

From:

   

# headeradd

Reply-To:php@test.net

From:php@test.net

Next, set up /etc/crontab to run couriermlm's hourly and daily commands:

# m h dom mon dow   user    command

@midnight           alice   couriermlm daily /var/lists/php_list

@hourly             alice   couriermlm hourly /var/lists/php_list

Finally, create some dot-courier files to direct administrative list mails to the appropriate user. These files go in the list manager's home directory. In this example, the php@test.net list is administered by user valorie. First, valorie creates /home/valorie/.courier-php. That tells the location of the php list:

/usr/bin/couriermlm msg /var/lists/php_list

Next is /home/valorie/.courier-php-owner:

valorie@test.net

And finally, /home/valorie/.courier-php-default:

/usr/bin/couriermlm ctlmsg /var/lists/php_list

This directs all the administrative list mail, such as subscribe/unsubscribe and help requests, to the correct mail list.

20.16.3 Discussion

The hourly and daily commands clean up any stale entries in the /var/lists/php_list/commands directory.

List users will use the following commands, in the list-command@domain format:

php-help@test.net

php-subscribe@test.net

php-unsubscribe@test.net

This is where those dot-courier files come into play, by directing these requests to the right places.

20.16.4 See Also

  • courier(8), dot-courier(5)

    Previous Section  < Day Day Up >  Next Section