Mailing lists are everywhere, and chances are one day you’ll want to set up your own mailing list. There are many choices out there, some specific to a particular e-mail system and some with varying degrees of ease-of-configuration, features, and so forth. Mailing list managers you may have heard of include Majordomo, Sympa, and Ezmlm.
In this Daily Drill Down, I’m going to take a look at Ezmlm-idx, an extended version of Ezmlm, which provides many enhancements over Ezmlm, such as multi-message threaded message retrieval from the archive, digests, message and subscription moderation, and a number of remote administration functions. It also modifies the configuration program, ezmlm-make, so that it uses a text-file template rather than compiled-in texts (in list creations) to enhance the default creation of new mailing lists, and it allows easy setup of mailing lists in different languages. Ezmlm-idx also adds improved handling of very large lists with optimized bounce handling, SQL support to allow sub-listing with improved message authentication and monitoring of list function, and dynamic addition/removal/reconfiguration of sub-lists. Basically, Ezmlm-idx was created to eliminate many common problems and to make using and administering Ezmlm as simple as possible.
You’ll need to obtain a copy of Ezmlm-idx from the FTP site. In this directory you’ll find TAR/GZipped archives and RPM archives for systems using RPM-based installations, like Red Hat Linux and Linux-Mandrake. As of this writing, the current version of Ezmlm-idx is 0.53.324, so be sure you grab the latest version. For this illustration, I will be installing and configuring Ezmlm-idx on a Linux-Mandrake system, so I’ll use the RPM method of installation. If you’re running an SQL database on your server, feel free to grab the appropriate RPM for your database type, either ezmlm-idx-mysql-0.53.324-1.i386.rpm or ezmlm-idx-pgsql-0.53.324-1.i386.rpm. These are versions of Ezmlm-idx with support for MySQL or PostgreSQL rolled in by default, and they will make use of those database types for administration and management of your mailing lists. Since I don't have a SQL database installed on this machine, I’ll download ezmlm-idx-std-0.53.324-1.i386.rpm, which is the standard version of Ezmlm-idx.
The only real requirement for Ezmlm-idx is it must work strictly with the Qmail Mail Transfer Agent. If you run another MTA, you’ll either want to look into Qmail (a highly recommended and powerful MTA) or look at another mailing list manager because Ezmlm-idx won’t work with Sendmail, Postfix, or any other MTA.
In order to install Ezmlm-idx, simply issue the following on the command line:
rpm -ivh ezmlm-idx-[type]-0.53.324-1.i386.rpm
This will install the RPM of whatever type of Ezmlm-idx you wish to install (either std, mysql, or pgsql). Once the command has completed, Ezmlm-idx is installed and ready to be configured.
Creating our first mailing list
The first thing we want to do is create an example mailing list. To do this, issue the following on the command line:
ezmlm-make -rdugm -5 mailto:firstname.lastname@example.org /var/qmail/alias/dummy
/var/qmail/alias/.qmail-dummy dummy mydomain.com
ezmlm-sub /var/qmail/alias/dummy mailto:email@example.com
ezmlm-sub /var/qmail/alias/dummy/digest mailto:firstname.lastname@example.org
ezmlm-sub /var/qmail/alias/dummy/mod mailto:email@example.com
The first command creates the mailing list itself. Here, you’re telling it to make a mailing list that can be remotely administered, digested, and posted to only by subscribers; the mailing list archive is guarded, and it is moderated. You are also telling it that mailto:firstname.lastname@example.org is the owner of the list, giving it the directory in which to store the mailing list, defining the dot-qmail file to use, and finally giving it the name and domain of the mailing list.
The second command, using ezmlm-sub, manually adds an address to the mailing list. With this command, you add mailto:email@example.com to the mailing list, so you’re already subscribed. The third command adds you to the digest version of the mailing list, and the fourth command makes you the moderator of the mailing list. Now you are the owner, remote administrator, and subscriber of mailto:firstname.lastname@example.org and mailto:email@example.com. Users can now subscribe by sending an e-mail to mailto:firstname.lastname@example.org and can post to the mailing list by sending an e-mail to mailto:email@example.com.
With this same configuration, if a non-subscriber sends an e-mail to the mailing list, the message will be forwarded to you, as owner, and you’ll be able to approve, reject, or ignore the message. If you want to remotely add a subscriber to the mailing list, send an e-mail to mailto:firstname.lastname@example.org, where the e-mail address at which to subscribe would be mailto:email@example.com.
Customizing ezmlm-make using ezmlmrc
You can further customize how new mailing lists are to be created on your system by taking advantage of the ezmlmrc file. This file is a control file that defines how new lists are to be created. By default, it’s installed as /usr/local/etc/ezmlmrc, but you may want to move it to /etc or create a symbolic link to /etc/ezmlmrc to make it the system-wide control file.
The format and structure of the ezmlmrc file can be quite confusing and overwhelming. There are a great many options that can be controlled and defined in this file. For users who want to make their own ezmlmrc file, simply copy it to ~/.ezmlmrc and use ezmlm-make with the -c option (for custom). The ezmlm-make will then use ~/.ezmlmrc instead of /etc/ezmlmrc for its control file.
Going into any great depth of the format and structure of the ezmlmrc control file here would be a large undertaking, so I'll simply point you to the man pages for ezmlmrc and the control file itself. The control file is heavily commented, and looking at the structure and design of the file should be enough to help you understand how to tailor it to suit your needs.
To remotely administer your mailing list, you’ll have to become familiar with the Ezmlm-idx addressing scheme. The owner/moderator of the list can perform a number of administrative functions for the mailing list by simply sending e-mail to various e-mail addresses for the list.
For example, to add a new subscriber to the mailing list, you would send an e-mail to mailto:firstname.lastname@example.org, and this will subscribe the user mailto:email@example.com to the mailto:firstname.lastname@example.org mailing list. You can likewise unsubscribe users by sending the message to dummy-unsubscribe as opposed to dummy-subscribe with the same address syntax. To deny a user from using the mailing list, you’d send an e-mail to mailto:email@example.com, which would prevent the user mailto:firstname.lastname@example.org from subscribing or posting to the mailing list. This is useful to ban users who cause problems or spam the mailing lists.
To obtain a copy of the log file for your mailing list, you can also send an e-mail. The log file shows you the subscription and unsubscription histories of the mailing list. To do this, send an e-mail to mailto:email@example.com, and you’ll receive the log file via e-mail. This is available only to the owner/moderator of the mailing list, as Ezmlm-idx protects the log file from regular users requesting it.
If you want to find out if a particular address has subscribed to the mailing list, you can send an e-mail to mailto:firstname.lastname@example.org to find out if the e-mail address mailto:email@example.com is a member. You can also access the subscriber list from your mailing list by sending an e-mail to mailto:firstname.lastname@example.org. Because this does pose a security risk, this option must be enabled when you run ezmlm-make by using the -l command-line option, which is disabled by default. Finally, you can also edit certain text files (like the body of the message sent to a user sending an e-mail to mailto:email@example.com) by sending an e-mail to mailto:firstname.lastname@example.org. You will receive an e-mail listing the various files that can be edited and instructions on how to edit them.
Moderating a mailing list
For moderated mailing lists, things are a little different. On a moderated mailing list, Ezmlm-idx will save a copy of the message and forward a request for acceptance to the moderator of the mailing list. Once you receive this e-mail, you have three choices:
- You can accept the message by replying to the Reply-To address of the message. This will send the e-mail back to the list, alerting Ezmlm-idx that you want to accept the message, and the message will be posted to the mailing list.
- You can also reject the message by replying to the From address of the message. This will send the e-mail back to the list, telling Ezmlm-idx that you want to reject the message. The message will be deleted at this point. Optionally, you can insert text explaining why the message is being rejected in between the two lines of the message containing "%%%" and the text will be sent back to the originator of the message. Regardless, a rejection notice is sent to the sender of the original e-mail message.
- You can simply ignore the message, which might be more acceptable than rejecting the message. If you do not reply to the message within five days, Ezmlm-idx will silently remove the message from the system, alerting no one.
Messages sent to the mailing list from the moderator are likewise sent back to the moderator for approval. This mechanism is in place to ensure that no one forges the moderator's e-mail address in an attempt to bypass approval of the message post.
Customizing the appearance of outgoing messages
Ezmlm-idx offers you many ways to customize the appearance of messages that go out from the list. Let's take a look at a few of the ways you can make your mailing lists look different (depending on the list as opposed to a system-wide default).
The first thing you can do is add a trailer to outgoing messages. Simply create the file /var/qmail/alias/dummy/text/trailer with the text you want to add to the bottom of each message. This text is not added to archived messages, so keep that in mind. Replace /var/qmail/alias/dummy with the directory of the mailing list to which you want to add the trailer. You can use the tag <#h#> for the list host, <#l#> for the local name, and <#n#> for the current message number.
Next, you can add a prefix to the subject of outgoing messages. For example, if you want all messages in your dummy mailing list to have a subject line like "[dummy] How do I use this?" where [dummy] is a persistent prefix, simply put the text in /var/qmail/alias/dummy/prefix. If you want to use square brackets (which is somewhat of a standard for prefixes), you would enter the following:
This will insert the text (as shown) as the prefix to the subject line in each message posted to the mailing list. You can also include the number of the message in the prefix by using the hash (#) character.
If you want to include additional headers in each message for the mailing list, you can place the header in the /var/qmail/alias/dummy/headeradd file. Put the headers in the file exactly as you want to see them in the messages; for example:
Another useful header to add would be the X-Sequence header, which basically contains the number of that particular message. To do this, place the following in your headeradd file:
Likewise you can remove headers from mailing list messages. To do this, place the headers you wish to remove in the /var/qmail/alias/dummy/headerremove file. The headers must be exactly as seen in the message without the ":" character. For example, to remove the Reply-To: header, put the following in the headerremove file:
Another useful feature is Ezmlm-idx's ability to strip parts from composite mime messages based on content type. This can be very useful in removing annoying little attachments like signatures and cards. To enable this feature, place the appropriate mime type into the /var/qmail/alias/dummy/mimeremove file. Some mime types you may want to include in this file might be text/ms-word and text/html.
Ezmlm-idx, by default, sets the From: header to the mailing list address and the To: header to the author's e-mail address. Although the author of Ezmlm-idx does not recommend changing this, there are benefits to changing it. The primary one is to make the list behave like other mailing lists, which traditionally add the From: header to the author's e-mail address while adding the To: and Reply-To: headers to the mailing list. To change this, put reply-to into your /var/qmail/alias/dummy/headerremove file and put Reply-To: mailto:email@example.com into your /var/qmail/alias/dummy/headeradd file.
Another useful feature is the ability to turn off the mailing list's default of echoing messages sent to the mailing list back to the original sender. This is useful in small mailing lists where having your own messages returned to you is an annoyance or for mailing lists with a robot involved that does all or most of the posting. To do this, edit the /var/qmail/alias/dummy/editor file and call ezmlm-send with the command-line switch of -C. This will exclude the sender from the recipient e-mail addresses.
Most of the notification messages that Ezmlm-idx sends are also customizable. If you aren't comfortable with editing the /etc/ezmlmrc file prior to making your mailing list, then you can edit the files in the /var/qmail/alias/dummy/text directory by hand afterwards. Some of the more common files you’ll most likely want to edit are the sub-ok and, for subscription moderated lists, mod-sub files. These files are the welcome message to the mailing list and contain information that’s important to new users of the mailing list. You can also have these files contain rules of the list, post guidelines, and so forth. A good file is the unsub-nop file, which is shown to users after an unsuccessful unsubscription request. The help file contains the information that is sent when a user sends a message to mailto:firstname.lastname@example.org, containing general information on how to use the mailing list. The bottom file is included on virtually all messages that Ezmlm-idx sends, while trailer adds the text to the bottom of each mailing list message.
There are many other useful commands, files, and ways of customizing your mailing lists to suit your needs. I've briefly explained only a few of the more commonly used ones. To get more detailed information, you should read the man pages for ezmlm-send and ezmlmrc.
Ezmlm-idx is by far my favorite mailing list manager, and I’ve looked at quite a few. There are many ways to customize and control your mailing lists. Ezmlm-idx is so flexible and versatile that it can be made to handle many different situations, from regular mailing lists to auto-responders. It’s a shame Ezmlm-idx can only be used with Qmail, because it’s such an incredible mailing list manager that users of other MTAs could really take advantage of its flexibility. However, a large portion of its flexibility is inherited from the structure and versatility of Qmail itself. The two working together make a powerful tool for managing any type or size of mailing list you may want to run.
See Vincent Danen's overview of the Qmail series.
Vincent Danen, a native Canadian from Edmonton, Alberta, is an avid Linux "revolutionary" and a firm believer in the Open Source philosophy. He attempts to contribute to the Linux cause in as many ways as possible, from his Freezer Burn Web site to local advocacy in his hometown. Owner of a Linux consulting firm, Vincent is also the security updates manager for MandrakeSoft, creators of the Linux-Mandrake operating system. Vincent is a certified Linux Administrator by Tekmetrics.com.The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.
Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.