Using Procmail   «Prev  Next»

Lesson 1

Using Linux procmail

As of September 2021, Procmail, a mail processing utility for Unix-like systems, is considered deprecated and unmaintained. Although it is still in use in some legacy systems, it is not recommended for new installations due to potential security vulnerabilities and a lack of updates.
Red Hat, the company behind the popular Red Hat Enterprise Linux (RHEL) distribution, officially deprecated Procmail in RHEL 7 and removed it from RHEL 8. The deprecation notice is available in the official RHEL 7 documentation:
For mail filtering and processing needs, it is recommended to use alternative tools and utilities, such as:
  1. Sieve: A powerful and flexible mail filtering language commonly used with the Dovecot IMAP server. Sieve scripts can be used for server-side mail filtering and organization.
  2. Maildrop: A mail delivery agent (MDA) with its filtering language similar to Procmail's, but with additional features and a more modern implementation.
  3. Milter: A family of mail filtering tools that work with the Sendmail and Postfix mail transfer agents (MTAs). Milters can be used to filter and process mail during the SMTP conversation, allowing for greater flexibility in mail processing.

When choosing an alternative to Procmail, consider the features and integration with your existing mail server infrastructure, as well as the community support and ongoing development of the tool.


Procmail is Linux's standalone email processor. With procmail, pronounced prock-mail, you can automatically filter and file your email, based on the body of your incoming emails or their delivery headers[1]. This capability allows you to automatically file messages you're not interested in seeing, such as SPAM[2]. In this module, you will learn about procmail and how to configure and invoke it. You will also learn about procmail's recipes, which form the basis of procmail's filtering capabilities, and how to test and troubleshoot your own recipes.

Learning objectives

After completing this module, you will be able to:
  1. Describe procmail and its use
  2. Configure procmail
  3. Compare condition and action flags
  4. Identify recipe conditions
  5. Describe recipe actions
  6. Invoke procmail
  7. List techniques for filtering mail
  8. Test procmail filters
  9. Troubleshoot procmail
The next lesson describes procmail and its use.

Delivery Headers used in procmail of Red Hat Linux

Question: What is the purpose of Delivery Headers when used in procmail of Red Hat Linux?
In the context of Red Hat Linux and the procmail mail processing utility, Delivery Headers serve an important purpose in facilitating the efficient and accurate delivery of email messages. Delivery Headers are special instructions that are added to the header section of an email message, specifying the desired delivery destination for the message. These headers can be used to direct the message to a specific mailbox, file, or program for processing, as well as to specify any additional options or parameters that should be applied to the delivery process.
By using Delivery Headers in procmail, administrators can create powerful and flexible email processing workflows that can handle a wide range of scenarios and requirements. For example, messages can be sorted and filtered based on their content, directed to different folders or mailboxes depending on their sender or subject, and even automatically forwarded to other recipients or systems for further processing. In addition to their versatility and flexibility, Delivery Headers also help to ensure the reliable and efficient delivery of email messages. By specifying the exact delivery destination and delivery options for each message, administrators can minimize the risk of errors or delays in the delivery process, and ensure that messages are processed and delivered in a timely and accurate manner.
Overall, Delivery Headers play a critical role in the operation of procmail and Red Hat Linux mail processing systems, providing an essential tool for managing and processing email messages efficiently and effectively.

[1]Delivery headers: Routing and control information found at the beginning of every email. Common headers include the destination (the "To:" header), the sender (the "From:" header), and the subject (the "Subj:" header).
[2] SPAM: A common name for unsolicited email, named after a Monty Python sketch. Recipes: A concise set of procmail instructions that filter or otherwise manipulate an email.