This site will work and look better in a browser that supports web standards, but it should be accessible for any browser or Internet device.
If you're seeing this message, you may have to scroll to the bottom of the page to see the navigation links.

Another Ezmlm Quick Start Guide

or how a dummy got ezmlm to work

Ezmlm, like qmail, is a great program, but I always seem to have a difficult time making it over the initial learning curve with new software. Usually because I want to do just a little more than usual. So, when I can I try to write up what I've learned to help the next person and to make it easier for me to do it next time.

In this case, I wanted to move three lists I was already running to ezmlm. The setup example in the standard Quick Start guide just covers lists off a specific user account. So john_smith might have john_smith-list@domain.com. The catch is that the existing lists I needed to move were all setup as list@domain.com. So, after a little head scratching, annoying people with emails and much digging in the faq, I came up with how to make it happen. Hopefully this will save you some of that trouble.

The Dreaded Install

First, you'll want to install ezmlm. The normal Quick Start details this nicely. Go get it done. I'll wait. I'm going to assume that qmail is the normal location ( /var/qmail ) and that ezmlm is also ( /usr/local/bin/ezmlm ). If not, keep that in mind as you go through this mini how-to.

Log in as root

To setup list like I wanted you have to log in as root. This, of course, means you have to be god of the box you're using. If you're not god of the box in question, seek out that person and beg them nicely --preferably with offerings of some kind-- and they might set this up for you.

It's good to first log in as something besides root. If you've never set up a non-root account, go do that now and save yourself much trouble. Once you've logged in as something besides root, switch to root:

> su

> password

Next, you'll want to switch to user alias. If, your distribution gives you any problems with this just make sure that you change the owner on everything that's create. Don't worry. I've got a note below to remind you to do that and tell you what files need to be dealt with.

> su alias

If this doesn't work and you feel daring, you can probably change things by hand so that you can do this. I can't vouch for what damage could be possible as a result of this, I just know that it can fix the issue.

First, go find your passwd file. You may find it at /etc/passwd. This means it's the master file for passwords. Changing things here could make your system vulnerable to crackaged among other things, so be very careful and backup the file be you change it.

In the passwd file you'll find a line that starts alias. Something like:

alias:!!:7771:2108::/var/qmail/alias:/bin/true

You'll need to change /bin/true so that it's /bin/bash. You'll also want to make sure that you have a * instead of !!. The above line would be changed to this:

alias:*:7771:2108::/var/qmail/alias:/bin/bash

But, you do this completely at your own risk. I'm not a security expert, so if evil festering crackers take over your machine, I'm not responsible.

Move to qmail's alias directory

This isn't neccessary, but it always makes my life easier.

> cd /var/qmail/alias

Create the List

Next, you'll create the list.

> ezmlm-make -rdug -5 me@domain.com ~alias/list ~alias/.qmail-list list domain.com

~alias is qmail short hand for the alias directory in your qmail directory (/var/qmail/alias/ normally). list is the name of your list. domain.com is the name of your domain.

So, if you wanted to create a list called slam and your domain was poetry.com, you'd create the list like this:

> ezmlm-make -rdug -5 me@poetry.com ~alias/slam ~alias/.qmail-slam slam poetry.com

This will create a directory (e.g. slam) in the alias directory, plus a bunch of .qmail files in the alias directory. (.qmail-list, .qmail-list-subscribe, etc.). The lists' directory (/var/qmail/alias/slam in our example) holds the guts of what makes your list work.

The flags (for example, -5) set various basic defaults for the list. To find out more about the flags and ezmlm-make in general, check out the manual page for exmlm-make.

Subscribe Yourself

Since a list is nothing without a few subscribers, it's a good idea to go ahead and subscribe yourself to the list and the digest. While you're at it, make youself god of this little world:

> ezmlm-sub ~alias/list me@host

> ezmlm-sub ~alias/list/digest me@host

> ezmlm-sub ~alais/list/mod me@host

In our example --with my address being tim@bubba.com-- the first command would be:

ezmlm-sub ~alias/slam tim@bubba.com

I'm Getting Cross-Eyed

If you get cross-eyed getting those squiggles and greek in the right spot, why not use our handy-dandy code writer. This handles lists of the form slam@poetry.com. If you want to create a list under your user (e.g. bob-slam@poetry.com), check with the documentation.

User (if you're bob@abc.com, bob)
Domain (e.g. poetry.com)
List Name (e.g. slam)
Make and Subscribe

Change the ownership of all this stuff to 'alias'

If you managed to log in as 'alias', you can skip this step. If not, you'll need to make sure that you do change the ownership on everything you've just created to 'alias'. Otherwise evil things will happen later. You're list may just plain not work, for instance. Fred Lindberg pointed out some other potential nastiness to me:

Also, if you [un]subscribe an address with ezmlm-[un]sub the corresponding address file will be owned by root and not changeable by alias later. This is a pain, since you'll have some addresses that can't subscribe, etc. Remember to always chown -R after ezmlm-[un]sub as root.

You've been warned. If you forget and things go blooey, don't scream too loudly. So here's how you forget this from happening:

> chown -R alias list

> chown alias qmail-list*

Help, FAQ and Info

Then, I like to customize the various information files that people can request: faq, info and help. In our example:

> cd slam/text/

> ls

I like to leave the help file almost as is. The info file I use for general information about the list. In the FAQ I usually mash that around into a question and answer format and add other information as I go. Make sure that you include information on acceptable conduct on the list. This files are stored in the text directory of your list.

You may want to change a few other files:

prefix (in the list's directory, not the text directory!): for text to put at the beginning of the subject line of every message posted to the list. A lot of people seem to like having the name of the list at the beginning of the subject line. In that case:

slam:

Don't forget the space after the colon!

trailer: text to put at the end of every message that's posted to the list. trailer, like prefix doesn't need to be in the text directory. Here I like to put something like:

_____________________________________

slam: a list about blah blah blah

for help, email slam-help@poetry.com

In case you're wondering, <#l#> should be synonymous with the name of the list (e.g. slam), but I've had intermitant luck getting it to work.

If you want to have people reply to the list instead of the individual subscriber, modify the headeradd file:

reply-to:

and in the header-remove file, add a similar line at the end:

reply-to

Like most of what you see here, there's a section in the FAQ on this.

Subscribing via a form

Do you want to create a form on your webpage that let's people subscribe and unsubscribe themselves? Vitration Technologies has a cgi script called ml-sub that does just that. The subscriber fills out the form and then gets the normal confirmation message. Virtation Technologies has a page with the script and information on it.

Graham Miller has written a script called MailGate that we're using here. We've added some improvements to allow it to handle any number of lists on any number of servers. And we've got instructions on how to use it here.

Importing a List of Addresses

You can import a file with a list of addresses without any fancy scripting. Again, DIR is the path of the directory that has the list. As long as your careful not to leave anything out, this works really well:

> xargs ezmlm-sub DIR < my_address_file

If your file of addresses contains one email address per line, you can also handle things the same way you handle a single subscription from the command line:

> ezmlm-sub DIR < list

When I first started working with EZMLM, I didn't know about either of those tricks --I have to thank people on the EZMLM mailing list for the suggestion-- so I took the brute force approach of creating a script to do this. Be careful that you change the script where indicated, because it's hardwired to look for a certain file and pull it into a certain list.

#!/usr/bin/perl
#
# load_addresses.pl
#
# A quick and dirty subscribe a bunch of people script
# Thrown together by Tim Wood in 1999
#
# This code is copyright under the Gnu Public License (GPL>
# copies available all over the web.
#
# Feel free to use this code, but I'd appreciate any suggestions
# for improvements: tim_wood[at]datawranglers.com
#
# ----------------------------------------------------------
# Some variables we'll use later
# myfile is the list of email addresses to load
#   all email addresses should be flush left seperated
#   by white space from other info
# zecommand is the ezmlm subscription command and any flags
# zelist is the address of the list as required by the ezmlm
#   command
#
$myfile = "./addresses.txt";
$zecommand = "ezmlm-sub";
$zelist = "/var/qmail/alias/texaspoetry";
#
# ----------------------------------------------------------
# read through the source file and subscribe everyone
open(theDB, $myfile) or die "Error opening file: $!\n";
  while(){
    ($zemail,$comment)=split(/\s+/);
    @args = ($zecommand, $zelist, $zemail);
    system(@args) == 0
      or die "system @args failed: $?";
    # print $zemail;
    # print "\n";
  } # End of while.
close (DB);
#
#
# $zemail = "zzz\@ze_test.com";
# @args = ($zecommand, $zelist, $zemail);
# system(@args) == 0
#   or die "system @args failed: $?";
#
#
exit;

Blocking Attachments

As long as you've got a reasonably current version of Ezmlm, blocking attachments is straightforward. If you want to do it when you set up the list, just add an x flag to the ezmlm-make command. For our test list 'slam', you'd create the list this way:

> ezmlm-make -rdugx -5 me@domain.com ~alias/slam ~alias/.qmail-slam slam domain.com

If you've got an existing list, you can just add the 'x' flag after the fact like we talk about below:

> ezmlm-make -+ -x /var/qmail/alias/slam

The default configuration will drops all attachments and just sends the message on through. If, on the other hand, you just want to entirely reject messages that include attachments, you'll have to do a little more work. First, move to DIR --in this case, /var/qmail/alias/slam-- and edit mimereject. The file probably doesn't exist yet, but any good text editor will create it without you even thinking about it:

cd /var/qmail/alias

cd slam

vi mimereject

Now we've got to tell it what types of emails to reject. type in: multipart/mixed. Then save and exit. Now, you should be off to the races.

You can find more information on this in the dot-qmail man page (man dot-qmail), the ezmlm-reject man page (man ezmlm-reject) or section of the ezmlm-idx FAQ and the ezmlm-idx FAQ in the "How does it work" section. Netiquette Enforcer has been suggested on the ezmlm mailing list as a good perl script to block other "useless" mail. The top of the script is also a good quicky guide to proper email netiquette.

Changing Flags Later

When you originally setup a list, there are a number of flags you set (the -rdug in the ezmlm-make command). If you want to change things later, it may not be completely clear from the documentation how to do this. At least I always have to bumble around with getting these things to work. Say you wanted to add the 'r' flag to our example list, you'd log in as root at make it so:

> ezmlm-make -+ -r /var/qmail/alias/slam

Make sure that you only add only flag per pass.

Deleting a List

Eventually, you may want to delete a list. Let's say that that list is our standard example: ~alias/slam. You'll need to:

rm -rf ~alias/slam

rm -rf ~alias/.qmail-slam

rm -rf ~alias/.qmail-slam-*

Of course, if you've got another list whose name begins with slam- this will delete it, too. In general, be careful, because you can't undo this change. If you're especially paranoid, you might copy all the files to a directory that ezmlm doesn't access.

If you're list is located somewhere else, either switch (CD) to that directory and drop the ~alias or use the full path to the directory that has the list in place of ~alias. As a bit of explanation, ezmlm creates a list of files and directories for each list. One is a directory with the name of the list; thus the first rm. In addition there are a series of files with names like .qmail-list (where list is the list name) and qmail-list-blahblah. All of these items need to be deleted or the list will limp along in some sort of limited form.

Some Testing Pointers

Testing whether a list is working is fairly easy. If you're subscribed, just send a message to the list. If it doesn't get sent out to you (and the other subscribers), there's a problem you'll have to run down. If it doesn't get sent out, make sure you check your mailserver first. There are any number of times where I've broken lists because I messed up my mailserver's configuration.

If the list has been operating successfully in the past, trying restarting qmail. Depending on your configuration, there are a number of ways to do this. On Redhat-style Linux (Redhat, Mandrake, LinuxPPC and so on), you'll want to change to /etc/rc.d/init.d and restart everything that begins with qmail:

>cd /etc/rc.d/init.d
>ls qmail*
>./qmail-pop3d restart

That last command restarts qmail-pop3d. You'll want to repeat that with all of the items in that directory starting with qmail. On other systems, such as Debian, this may be done different ways.

Always check the simple things first. Is there a regular user on the system with the same name as your list? Email will typically get routed to users on the system before Ezmlm mailing lists. Are the ownerships and permissions on the files correct (see above)? Make sure the home directories of your users, their Maildir (or Mail or whatever their mail directory is called) and that folder's subfolders are not world-writable. If you do an ls on a users home directory, the persmission should be : rwx r-x r-x. if not use chmod (chmod 755 directoryName) to fix the permissions.

Testing digests seems like a pain. Post a bunch of messages and see if something comes back. Very tedious. Especially if you run into a persistant problem. But, fortunately, there's an easier way. Petr Novotny was kind enough to forward a post from fred Lindberg that gives a way to force a digest to send. First, make sure you send a message so that there's something to include in the digest. Then, from a prompt, type in:

ezmlm-get DIR

Dir is the directory for your list. So, if your list is our standard example ~alias/slam, the command would be "ezmlm-get ~alias/slam". Do not put /digest on the end. Assuming you remembered to send something to the list first and things are working properly, a digest should go right out.

Check that /var/qmail/control/me and /var/qmail/control/defaultdomain contain the same domain as your list is using: datawranglers.com:datawranglers-com.

The ezmlm-check can be helpful, too. If you can get a ~alias list working or a user list working, it can be useful to compare the results of ezmlm-check on a working and a non-working list. For instance for the list slam:

ezmlm-check ~alias/slam > ~alias/test.txt

You should also look at going through the standard INSTALL checks:

How to test:

 4. Make sure ezmlm-make is in your path. Create a mailing list:
       % ezmlm-make ~/testlist ~/.qmail-testlist me-testlist host
    Replace ``me'' and ``host'' with your e-mail address.
 5. Subscribe yourself to the list manually:
       % ezmlm-sub ~/testlist me@host
 6. Send a message to the list:
       % echo subject:testing | qmail-inject me-testlist@host
    You should receive a copy of the message at me@host.
 7. View the list membership:
       % ezmlm-list ~/testlist
    You should see just one line, containing your address.
 8. Unsubscribe yourself through e-mail:
       % qmail-inject me-testlist-unsubscribe@host < /dev/null
    When you receive the confirmation number, reply to complete your
    unsubscription. Use ezmlm-list to check that the list is empty.
 9. Retrieve the first message from the archive:
       % qmail-inject me-testlist-get.1@host < /dev/null
    You should receive a copy of your subject:testing message.

You may also want to go through INSTALL.idx. In particular, it's good to test:

 8. Test the programs:
        a. Create a user ``eztest'' or edit ezmlm-test to use another user name.
           This user should be able to execute the new binaries and also needs
           to have read access to ezmlm-test (chmod 755 ezmlm-test).
        b. Change to that user.
        c. From the build directory, execute ezmlm-test:
                % ./ezmlm-test

/etc/ezmlmrc is very helpful. The inlocal file in your list directory (/var/qmail/alias/slam in our example):

# One of the major problems with ezmlm-lists is DIR/inlocal. For normal
# users, it is set up to the list name (user-list or so), which is correct.
# However, for user 'ezmlm' in control of virtual domain 'host.dom.com'
# the list name is 'list@host.dom.com', but inlocal should be 'ezmlm-list',
# not 'list'. Similarly, if ezmlm-domain1 is in control of 'host.dom.com,
# list@host.dom.com, should yield an inlocal of 'ezmlm-domain1-list'. To
# always get the lists correct, place this file as '.ezmlmrc' in the
# users home directory (~ezmlm/.ezmlmrc) and change the inlocal text below
# to 'ezmlm-<#L#>' or 'ezmlm-<#1#>-<#L#>, respectively.
# config to support future editing without giving ezmlm-make command line
# arguments other than dir. Useful for GUI/WWW editing tools

check the permissions on your list. In general, files should be owned by the user 'alias' in the group 'nofiles'.

Finally, once you get the list working the way you want, it's not a bad idea to make a full back-up of the list's directory (~alias/slam) in our example in case you muck things up later. I also like to make backups of my mailserver's configuration. At the very least, try to keep notes on key problems you run into, so you don't have to figure them out again later.

Seeing the List of Subscribers

You can check the subscribers for a list with the following command. DIR would be the path of the directory that has the list. For example, ~alias/slam/ in our example.

> ezmlm-list DIR

You'l sometimes see an error that looks like this:

dir and dot must start with slash

Most of the time that really means that that ezmlm command wants to see the entire path to the list or that you've left out the path entirely.

If you're looking to see if one person is subscribed, a wonderful trick with lists more than a few people long is to run the results through grep. Let's say you're running our wonderful slam list which hasn't left ~alias/slam, let alone the building. john_smith@zyx.com is wondering why he's not getting mail from the list. You can see if there's a smith subscribed:

ezmlm-list ~alias/slam | grep smith

Every line that has smith in it will show up. So, you might see:

john_smith@mail.zyx.com

smithey@aol.com

john_boy@smithWorx.com

Then you can find a polite way to tell john what's happened. Our you can tweak EZMLM to realize that 'mail.' is immaterial.

Other Sources of Information

Ezmlm.org, which includes the EZMLM FAQ, information on mailing lists for ezmlm, man pages and more. Know this place, love this site, sacrifice small lovable furry things to it. But, bookmark a mirror. Because the main site is overburdened. I've had a lot of luck with the Canadian Mirror.

Livelink Search is an archive of a government mailing list for several mailservers and includes some discussion of ezmlm. Make sure you include ezmlm in your search.

If you get really ambitious, you might take a look at Advanced Mailing Lists with ezmlm.

Qmail Odds and Ends

This section is for a few useful Qmail bits and pieces that I use frequently, so I thought someone else might too:

  • The qmail newbie's guide to relaying. You might also check out http://www.davideous.com/smtp-poplock/
  • If you'd lke to see what's in your qmail queue, check out QM Handle.
  • If you find out you need to flush a bunch of messages with a common text string or pattern in them, check out Qmail-Remove.

Thanks

Special thanks to Frederick Lindberg (lindberg@id.wustl.edu) for gently nudging me as I was figuring out how to do this.

Version History

v0.010 released 20 February 2002. Added a Qmail Odds and Ends section.

v0.009 released 23 July 2000. Added more troubleshooting notes and directions on restarting qmail on redhat systems.

v0.008 released 22 July 2000. Added another method of subscribing a list of people.

v0.007 released 29 June 2000. Re-wrote section on blocking attachments. Fixed minor problems including some screwy formatting.

v0.006 released 11 March 2000. Added notes on various tweaks you can do such as making replies go to the list and cleaned up others. Started a section on testing.

v0.005 released 17 November 1999. Added notes on blocking attachments and deleting lists.

v0.004 released 9 November 1999. Added notes on ml-sub.

v0.003 released 12 August 1999. Added notes on importing addresses, viewing the list of subscribers to a list and the meaning of the dir and dot must start with slash error message.

v0.002 released 9 August 1999. How to 'fix' broken alias entry in /etc/passwd added. Minor changes to sections.

v0.001 released 8 August 1999.

Copyright

This document is copyright 1999 Tim Wood, but may be redistributed and included in other documents as long as this copyright notice is included.

Suggestions, Errors and Chocolate Cookies

If you notice any errors or have suggestions, please email ezmlm_howto_suggestions@datawranglers.com. The original version is currently kept at http://www.datawranglers.com/docs/ezmlm_howto.html

Raspberries and Insults

May be mailed to: Microsoft Corporation; Redmond, WA USA