SmartList tips

Here are some recipes and tips for the procmail mail-filtering software and related SmartList mailing list software. Most of this code is in use on the 3x3 Eyes Mailing List. Feel free to use this information in any way you like.
(OK, so this is not really a software project, but I thought it might be useful all the same.)

procmail is a great tool for handling mail. Unfortunately, SmartList is a nasty hack built on top of procmail. I like SmartList because it is very flexible, and unlike majordomo it can be customized without root access to the host machine. It is too bad that it takes so much customization just to reach the basic functionality of majordomo.

If you want to use SmartList, I highly recommend installing the latest confirm package by Werner Reisberger. This will save you a lot of headaches. After that, you can take a look at my list configuration files (15.2KB ZIP file) for setup hints. This is for an unmoderated list with a companion digest list, and your setup may be somewhat different. Most of the custom code was found elsewhere, like in the SmartList FAQ or on the SmartList mailing list.

One bit that I did write all by myself is the procmail recipe to automatically add digest posts to an online archive. This goes in the .procmailrc file on the web account (which must be subscribed to the digest list, obviously):

# Archive 3x3 Eyes ML digests for WWW
# (Y2K compliant hack)
:0
* ^TO_3x3eyes-digest@sazan.net
* ^X-Mailing-List: <3x3eyes-digest@sazan.net>
{
  # find directory name
  ARCHDIR=`awk '$1 == "Subject:" {printf "public_ftp/pub/3x3EyesML/volume2%03d", substr($4,2)}'`

  # create directory if it does not exist
  UMASK=022
  :0 Wic
  * ? test ! -d $HOME/$ARCHDIR
  | mkdir $HOME/$ARCHDIR

  # create a filename based on digest volume and number
  :0 hw
  SAVE=| awk '$1 == "Subject:" {printf "Digest%03d.txt", substr($5,2)}'

  # store mail in archive folder
  UMASK=333
  :0 c:
  $HOME/$ARCHDIR/$SAVE
}

This stores the digests in individual, sequentially-numbered files. It works well in combination with a conventional web search script for browsing the archive. The recipe can be used by any subscriber, not just the list admin. Smartlist has never been updated to fix the Y2K volume bug (at least on my server), so I added some hacks to the recipe above to use directories named after the current year (e.g., volume2001). The recipe also creates the directory if it does not exist. I'm sure the code could be cleaner, but once I get something working procmail, I try to never touch it again.

The last bit of SmartList magic are two cron jobs that run on the server:

53 16 * * * touch /slist/3x3eyes-digest/.digest.force
03 17 * * * /home/my_id/public_html/cgibin/build.cgi

The slist account has its own daily cron job for checking whether to send out digests. The first job above forces the digest to be sent by creating a .digest.force file in the list directory. (This file is deleted after the digest is sent which is why it is recreated daily.) The second job generates the search index file for the digest archive.

Finally, here a zip file of some HTML forms (3.67KB ZIP file) that can be used for managing the mailing lists. These forms are designed to work with cgiemail, a nice form-to-email CGI script. The forms do not have to be on the same server as the mailing list.

I do not claim that the material presented here will provide an optimal SmartList configuration, but it works for me. Frankly, this is the type of program that I'm afraid to touch once it is working, lest I unwittingly break something. Hopefully these files will help you get your list(s) working, too.

© David Park
Last updated: March 1, 2011 3:30AM UTC