Procmail
Encyclopedia
procmail is a mail delivery agent
Mail delivery agent
A mail delivery agent or message delivery agent is a computer software component that is responsible for the delivery of e-mail messages to a local recipient's mailbox...

 (MDA) capable of sorting incoming mail into various directories and filtering out spam messages. Procmail is widely used on Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

-based systems and stable, but no longer maintained; users who wish a maintained program are advised to use an alternative MDA, such as maildrop
Maildrop
maildrop is a Mail delivery agent used by the Courier Mail Server. The maildrop MDA also includes filtering functionality.maildrop receives mail via stdin and delivers in both Maildir and mbox formats....

.

Invocation

The procmail mail delivery agent
Mail delivery agent
A mail delivery agent or message delivery agent is a computer software component that is responsible for the delivery of e-mail messages to a local recipient's mailbox...

 is generally not started from the command line, but is usually invoked by mail delivery subsystems, such as a mail transport agent (like Sendmail
Sendmail
Sendmail is a general purpose internetwork email routing facility that supports many kinds of mail-transfer and -delivery methods, including the Simple Mail Transfer Protocol used for email transport over the Internet....

 or Postfix
Postfix (software)
In computing, Postfix is a free and open-source mail transfer agent that routes and delivers electronic mail. It is intended as a fast, easier-to-administer, and secure alternative to the widely-used Sendmail MTA....

), or from a mail retrieval agent
Mail retrieval agent
A mail retrieval agent is a computer application that retrieves or fetches e-mail from a remote mail server and works with an mail delivery agent to deliver mail to a local or remote email mailbox. MRAs may be external applications by themselves or be built into a bigger application like an MUA...

 (such as fetchmail
Fetchmail
Fetchmail is an open source software utility for POSIX-compliant operating systems which is used to retrieve e-mail from a remote POP3, IMAP, ETRN or ODMR mail server to the user's local system. It was developed from the popclient program, written by Carl Harris.Its chief significance is perhaps...

).
This makes the mail processing event-driven. The companion-tool formail allows procmail to be used in batch-processing on mail that already is in a user's mailbox.

Recipes

The procmail agent uses recipes, to determine where to deliver the various mail messages.

Recipes can be conditional or unconditional

Recipes used by procmail can be conditional or unconditional. If the conditions are left out, the recipe is unconditional.

Types of recipes

Procmail has two kinds of recipes:
  • Delivering recipes
  • Non-delivering recipes

Processing of recipes

Recipes are read from top to bottom. The first delivering recipe terminates the delivery process (unless the mode flag specifies otherwise).

Conditions

Conditions are usually extended regular expressions, although there are other forms of condition also.

Basic operation

The procmail tool reads mail messages given to it from standard input. The procmail tool will process the recipes before distributing the mail messages into the appropriate mailboxes.

Other operations

Other common operations carried out with procmail include filtering and sorting of emails into different folders according to keywords in from, to, subject, text of the mail, or sending autoreplies, but more sophisticated operations
are also possible.

Spam filtering

A common practice is to let procmail call an external spam filter program, such as SpamAssassin
SpamAssassin
SpamAssassin is a computer program released under the Apache License 2.0 used for e-mail spam filtering based on content-matching rules. It is now part of the Apache Foundation....

. This method can allow for spam to be filtered or even deleted.

Managing mailing lists

The procmail developers have built a mailing list manager called SmartList
Smartlist
SmartList is a computer software application for managing electronic mailing lists, which is built on top of Procmail, and is maintained by the Procmail developers.SmartList is free software, distributed under the GNU General Public License....

on top of procmail.

Further reading

  • Martin McCarthy, The Procmail Companion, Addison-Wesley, S. 256, November 2001, ISBN 0-201-73790-6

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK