mirror.ncsa.uiuc.edu/procmail-faq/mini-faq.html#split
In the Contents, I try to include a mention of all very frequently asked questions, even if they're in a subsection of a subsection (further adding to the bloat, I'm afraid). The below table of contents is an abridged "best of" instead of a full TOC. Or, how can I let several local users share the same POP mailbox at the upstream? Or, what is the most frequently made wrong assumption about mail delivery? Description, availability, and installation Procmail is a mail processing utility, which can help you filter your mail; Procmail is also a complete drop-in replacement for your MDA. See Infinite Ink's 78 Mail Filtering and Robots page for information about related utilities for various other platforms, and competing Unix programs, too (there aren't that many of either). You can download Procmail from the 79 main Procmail site or a number of mirrors. The Links page has a listing of 80 well-established mirror sites. The installation procedure is fairly straightforward but probably not the first thing you should attempt after you get a Unix account. If you feel adventurous, and have a friend with a working copy of Procmail for your type of operating system and hardware, you can just snatch her/his binary. However, you need to be aware that this defeats some checks which the installation program performs, such as determine where your mail spool is, what kinds of file locking should be employed, etc. Be particularly wary if you use NFS-mounted mail spool directories. The distribution comes with a 83 simple FAQ (locally produced HTML version -- the 84 text-only original is also available) which covers some issues faced when first getting acquainted with Procmail, such as how to view the manual pages, but it primarily addresses various installation problems. There's also answers to some very frequently asked questions, some of which are not dealt with in the document you're reading now. Please look at least at the TOC of the "original" FAQ as well. If you are new to Unix, you should probably read up on regular expressions (grep/sed/awk/perl etc) and a little on mail handling before attempting to tackle the Procmail manual pages. Related quick questions Q: I just downloaded Procmail, and want to learn to write my own recipes. A: The distribution package comes with some pointers, and includes manuals, of course. In addition to that, the 87 links page, which is a companion page to this FAQ has links to several good tutorials. There is also a small collection of links 88 near the end of this FAQ. There are many good tutorials and the purpose of this FAQ is not to compete with them, although some basic questions about Procmail's syntax recur in various on-line forums often enough to warrant their inclusion here as well. A: No, and it's somewhat unlikely that anybody would undertake a port. Excerpt: "I've seriously looked at porting it to NT, yes. Correction: Even simpler, you can leave out the condition lines completely if you want to do your action (in this case, run a shell script) unconditionally. More-complicated conditions can also be exit codes of other shell scripts or programs, or tests against the full body of the message, or against Procmail variables (Procmail's variables are also exported to the environment of subprocesses, so they are essentially environment variables. Finally, the action can be a nested block of more "recipes," as these condition-action mappings are called in Procmail jargon, to try if the outer condition is met. Obviously, you are not restricted to Perl or shell scripts. Anything you can run from a Unix command prompt can be run from Procmail, in principle, although running interactive programs doesn't usually make much sense. Make sure you find all of the pages procmail, procmailex, prorcmailrc, and regexp (or perhaps egrep or grep if you don't have a general introduction to regular expressions on your system). Q: Please please tell me the address of the Procmail mailing list! A: See answer to previous question, or the 104 periodic Mini-FAQ pointer posting. There used to be an alternative list, which was started by Rhett 'Jonzy' Jones, but it appears to be dead. There is now also a procmail-dev list for those interested in developing Procmail, and similarly a smartlist-dev for SmartList development. The 107 links page has links to various resources, including tutorials and examples. Please don't assume that the FAQ author is interested in inquiries about free consulting services. I read the Procmail mailing list and answer questions when I can. Several others do that too, so you stand a better chance of getting a decent answer by mailing the list rather than me. Keep the subscription instructions around, so you know how you got on the list in the first place -- usually getting off the list involves a very similar procedure. See also the 108 Unsubscribe FAQ * Procmail-specific instructions: + Don't ask questions which are answered in the documentation or in the FAQs. In addition to the time of others, you will be wasting your own, because most of the people who read your message will silently ignore you (or in bad cases mutter to themselves and killfile you for all eternity. Procmail users are particularly well equipped for this). Use the Subject header to label your message for the reader (not for yourself). Subjects like "Procmail," "Help," or "Problem" will be the first to be skipped by those who don't have the time to read all messages all the time. Similarly, in the message itself, you should describe your problem in concrete terms. Often a "model message" (trimmed down to a bare minimum; If you did try all of the above, please mention it in your message. At the very least, it tells people you did do your homework. By the way, the 109 debugging section below has some suggestions for additional things to try before you post. An additional tip: You should perhaps familiarize yourself with the FAQs for related Usenet newsgroups. A: The list is presently open for posting by anyone, including the spammers. This may have to be changed because of the rising tide of spam, which would be unfortunate, because many people might not want to be bothered to subscribe to the list in order to just ask one question. A: Try subscribing yourself anew and see if things start to change. SmartList is rather paranoid and will easily unsubscribe you if it gets bounces from your address. You can check there whether you have received the newest messages. The neat stuff starts when you want to ignore "pro-mail" and "ProMail" while still looking for anything else that begins with "pro" and also contains "mail", but this example 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) at your site should contain a concise listing of regular expression operators.
This regular expression will catch any sequence of horizontal whitespace (including none at all -- change the * to a + if you want to make sure there's at least one whitespace character). Some mailer programs use tabs instead of spaces in some places, others will attempt to "pad" all header fields with spaces to make the headers somewhat more readable. Finally, Subject headers are written by mere humans who sometimes press the space bar twice, perhaps only because they want to see if that will break your autoresponder script. Therefore, your Procmail recipes frequently need to match arbitrary runs of whitespace characters if you want them to work in all situations. File locking Under Unix and other multitasking operating systems, several processes can be running at once. This means several mail messages can be in delivery at the same time. Without Procmail, the default system mailer hopefully handles this just fine when mail is delivered to a system mailbox, but if two Procmails are delivering two messages to the same file more or less at the same time, you end up with problems. Don't use file locking when delivering to /dev/null (because then it doesn't matter if the message gets mangled, and you migh...
|