Procmail Mini-FAQ v1.0

This is included here for historical purposes only. This is known to contain miscellaneous warts, errors, typos, and broken links. For hopefully more accurate information, consult the most recent version of the Procmail Mini-FAQ
[March 1999: I've added some annotations, like this one, as a bit of commentary.]
This is a draft FAQ for Procmail, the mail processing utility.

This document is a minimalist attempt at answering the most often asked questions and straightening out the most frequent misconceptions about Procmail. This is no substitute for the manuals, and indeed mostly contains pointers to the manuals and other similar resources, as well as a small collection of links to more information.

Please take a minute to skim through at least the Contents section below, so you know which issues are discussed here.

The author's contact information is at the bottom of this page

Contents

What is Procmail?

Description, availability, and installation

Procmail is a mail processing utility, which can help you filter your mail, sort incoming mail according to sender, Subject line, length of message, keywords in the message, implement an ftp-by-mail server, and much more.

Procmail is also a complete drop-in replacement for your MDA. (If this doesn't mean anything to you, you don't want to know.)

Procmail runs under Unix. See Infinite Ink's Mail Filtering and Robots page for information about related utilities for other platforms (there aren't that many).

The recommended version of Procmail to install is 3.11pre4 . You can download it from the main Procmail site or get it from a comp.sources.unix mirror.

[The documentation stated new versions would get posted to comp.sources.misc long after Stephen had stopped doing this. Of course, I even got the newsgroup wrong.]
The installation procedure is fairly straightforward but probably not the first thing you should attempt after you get a Unix account.

You can't just snatch somebody's copy, because the installation procedure needs to determine where your mail spool is, what kinds of file locking should be employed, etc.

The distribution comes with a simple FAQ (text only, no HTML) which covers many issues faced when first getting acquainted with Procmail, ranging from where the manual pages go to rather technical issues.

This FAQ does not try to delve into any of the "deep" issues, although some of them are rather frequently brought up on the Procmail mailing list. You might want to look at the Best of Procmail archive for solutions before you mail the list about your problem.

Related quick questions

Q: What if Procmail is already installed by another user on my host?

A: Could be. Ask around. Yes, one installation per site should suffice.

How do I use wildcards in Procmail?

... and other syntax issues

Procmail uses regular expression syntax, which is more complicated but also vastly more versatile than the "glob" wildcards used in many shells for matching file names (where pr*mail matches anything which starts with "pr" and ends with "mail").

Briefly, the regular expression to match anything that begins with "pr" and ends with "mail" is ^pr.*mail$ but for practical purposes, e.g. in a Subject: line, you might want to try the following recipe:

:0:
* ^Subject: pr.*mail
procmail-mail
This says: Anything that begins with "Subject: pr" and contains the string "mail" somewhere after that is to be saved in the folder procmail-mail.

The neat stuff starts when you want to include "procmail" but exclude "pro-mail" and "ProMail" while still looking for anything else that begins with "pro" and also contains "mail", but this tutorial ends here.

Any beginners' book about Unix will contain a more detailed tutorial on regular expressions, most likely in conjunction with examples using the grep and sed programs. For reference, the manual page for egrep (an extended grep) contains a concise listing of regular expression operators.

Related quick questions

Q: Wouldn't it be much simpler to just use glob-like patterns? Does this mean I have to learn something new again? Ugh.

A: Yes. Don't bother with Procmail if you want something simple and stupid.

Q: Why doesn't this work?

:0:
* ^TO:.*|*reguler ixpressiun full of synutsax errors as weel as typoes**.*
! mailto:dev@null  # this isnt correct is it? Help!
[I'm sorry, but at the time, I thought this was hilarious. I guess I still do :-]
A: Various syntax errors notwithstanding (read the manual), you shouldn't use a wildcard after the ^TO macro. Try this:
:0 # no need to lock /dev/null ...
* ^TOregular expression without syntax errors or typos
/dev/null

Help, I get this error message ...

Troubleshooting tips

The light bulb contains the seeds of its own revolution.
[This is the punch line from the old joke "How many Marxists does it take to change a light bulb?" Another case where I just couldn't help myself, I'm afraid. As a matter of fact, it's still in the FAQ, for hysterical reasons, although I don't expect many people will appreciate it. Anyway, it's supposed to mean "You can and should learn to help yourself."]
Before you panic, try adding VERBOSE=yes to your .procmailrc and examine the information about Procmail's actions that are written to the log. This tells you, in excruciating detail, about every decision Procmail makes while processing your rc file.

The error messages and some plausible explanations are listed on the Procmail manual page. If you haven't before, now is the time to read the manual pages. Note that there are several; procmailrc discusses the syntax of the rc files while procmailex contains some nifty examples.

Where can I learn more?

Small links collection

Kudos
This FAQ draws very heavily on Nancy McGough's excellent collection of mail filtering resources. If you only bookmark one web page this year, make sure it's an Infinite Ink one! And thanks, Nancy.


The official location of this page is http://www.iki.fi/~era/procmail/mini-faq.html -- please use this redirector URL instead of whatever it happens to point to when making references to this page.

Version information:
$Id: mini-faq.prep,v 1.1 1996/12/11 15:41:51 reriksso Exp $

Please mail me with any feedback or comments to this FAQ!