Procmail
   HOME

TheInfoList



OR:

procmail is an
email Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" meant ...
server software component — specifically, a
message delivery agent A message delivery agent (MDA), or mail delivery agent, is a computer software component that is responsible for the delivery of e-mail messages to a local recipient's mailbox., ''Internet Mail Architecture'', D. Crocker (July 2009) It is also call ...
(MDA). It was one of the earliest
mail filter Email filtering is the processing of email to organize it according to specified criteria. The term can apply to the intervention of human intelligence, but most often refers to the automatic processing of messages at an SMTP server, possibly appl ...
programs. It is typically used in
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
mail systems, using the
mbox Mbox is a generic term for a family of related file formats used for holding collections of email messages. It was first implemented in Research Unix, Fifth Edition Unix. All messages in an mbox mailbox are concatenated and stored as plain text ...
and
Maildir The Maildir e-mail format is a common way of storing email messages in which each message is stored in a separate file with a unique name, and each mail folder is a file system directory. The local file system handles file locking as messages are ...
storage formats. procmail was first developed in 1990, by Stephen R. van den Berg. Philip Guenther took over maintainership for a number of years, but relinquished the role in 2014. The software remained unmaintained for several years, and was believed to be defunct. In 2020 May, Stephen van den Berg resumed maintenance again. The program has since seen multiple releases and bug-fixes.


Uses

The most common use case for procmail is filter mail into different mailboxes, based on criteria such as sender
address An address is a collection of information, presented in a mostly fixed format, used to give the location of a building, apartment, or other structure or a plot of land, generally using political boundaries and street names as references, along ...
, subject keywords, and/or
mailing list A mailing list is a collection of names and addresses used by an individual or an organization to send material to multiple recipients. The term is often extended to include the people subscribed to such a list, so the group of subscribers is re ...
address. Another use is to let procmail call an external spam filter program, such as
SpamAssassin Apache SpamAssassin is a computer program used for anti-spam techniques, e-mail spam filtering. It uses a variety of spam-detection techniques, including Domain Name System, DNS and fuzzy checksum techniques, Bayesian spam filtering, Bayesian filt ...
. This method can allow for spam to be filtered or deleted. The procmail developers have built a mailing list manager called SmartList on top of procmail. Procmail is an early example of a mail filtering tool and language. It is a
data-driven programming In computer programming, data-driven programming is a programming paradigm in which the program statements describe the data to be matched and the processing required rather than defining a sequence of steps to be taken. Standard examples of dat ...
language, similar to earlier line-oriented languages such as
sed sed ("stream editor") is a Unix utility that parses and transforms text, using a simple, compact programming language. It was developed from 1973 to 1974 by Lee E. McMahon of Bell Labs, and is available today for most operating systems. sed w ...
and
AWK AWK (''awk'') is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems. The AWK lang ...
.


Operation

procmail reads mail messages given to it on
standard input In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
, delivering or otherwise dispositioning each one. procmail is typically not invoked directly by the user. Rather, some other mail program will call upon procmail to deliver a message according to the user's wishes.
Message transfer agent Within the Internet email system, a message transfer agent (MTA), or mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using SMTP. The terms mail server, mail exchanger, and MX host ...
s (MTAs), such as
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 (SMTP) used for email transport over the Internet. A descendant of the ...
or Postfix), can be configured to use procmail to deliver all mail. A
mail retrieval agent A mail retrieval agent (MRA) is a computer application that retrieves or fetches e-mail from a remote mail server and works with a mail delivery agent to deliver mail to a local or remote email mailbox. MRAs may be external applications by them ...
such as
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, or ODMR mail server to the user's local system. It was developed from thpopclientprogram, written by Ca ...
can invoke procmail as needed. The companion tool ''formail'' allows procmail to be applied to mail already in a mailbox. procmail's behavior is controlled by a
config file In computing, configuration files (commonly known simply as config files) are files used to configure the parameters and initial settings for some computer programs. They are used for user applications, server processes and operating system se ...
(by default, in the user's
home directory A home directory is a file system directory on a multi-user operating system containing files for a given user of the system. The specifics of the home directory (such as its name and location) are defined by the operating system involved; for ...
) containing one or more ''recipes'', read in order. Each recipe consists of a ''mode'', zero or more ''conditions'', and an ''action''. Conditions are usually extended
regular expressions A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" o ...
, although there are other forms. A recipe's action is taken only if all the conditions match (logical AND). If no conditions is given, the recipe is unconditional and the action always runs. The action specifies what is to be done with the message, such as deliver it to a particular mailbox, or discard it. A recipe and its action can be ''delivering'' or ''non-delivering''. Processing of a given message stops with the first delivering recipe (unless the recipe's mode flag specifies otherwise).


Example

A simple config file might look like this: MAILDIR=$HOME/mail DEFAULT=$MAILDIR/inbox :0: * ^List-Id: .* foo-announce The above routes mail from a hypothetical mailing list to a separate mailbox called , while delivering all other mail to the mailbox, both located under the directory.


Criticism

By default, procmail will "bounce" undeliverable mail back to the sender, or discard it entirely. A mistake in the config file can result in all mail being rejected or discarded. The configuration file format is sometimes regarded as cryptic. procmail is not well-suited for processing mail involving
Multipurpose Internet Mail Extensions Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of email messages to support text in character sets other than ASCII, as well as attachments of audio, video, images, and application programs. Message ...
(MIME). It cannot decode or recognize MIME-specific headers or international characters. For approximately ten years, procmail was not maintained, and multiple serious security vulnerabilities were discovered in the intervening time span (since fixed).


See also


Mail architecture

*
Email Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" meant ...
*
Message transfer agent Within the Internet email system, a message transfer agent (MTA), or mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using SMTP. The terms mail server, mail exchanger, and MX host ...
*
Message delivery agent A message delivery agent (MDA), or mail delivery agent, is a computer software component that is responsible for the delivery of e-mail messages to a local recipient's mailbox., ''Internet Mail Architecture'', D. Crocker (July 2009) It is also call ...
*
Mail retrieval agent A mail retrieval agent (MRA) is a computer application that retrieves or fetches e-mail from a remote mail server and works with a mail delivery agent to deliver mail to a local or remote email mailbox. MRAs may be external applications by them ...
*
Simple Mail Transfer Protocol The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typica ...


Similar programs and technologies

* fdm (fetch, filter and deliver mail) *
maildrop Maildrop is a Mail delivery agent used by the Courier Mail Server. The maildrop Mail Delivery Agent (MDA) also includes filtering functionality. Maildrop receives mail via stdin and delivers in both Maildir and mbox formats. Features Mai ...
* Dovecot * Sieve mail filtering language


References


Further reading

*


External links

* — Current source code repository and distribution point * — Procmail homepage, as it appeared when it was working * {{cite web , url = http://procmail.markmail.org/ , title = Procmail Home - MarkMail - Community libraries — Searchable archives of the procmail mailing list Mail delivery agents Cross-platform software