Using Procmail   «Prev  Next»

Lesson 10Testing filters
ObjectiveTest procmail filters.

Procmail has been deprecated since RHEL 7.7

Procmail has been deprecated in Red Hat Enterprise Linux 8. It was originally deprecated in RHEL 7.7, and will no longer be supported in future major releases of RHEL.
Procmail is a mail filtering utility that was developed in the early 1990s. It is a powerful tool that can be used to filter incoming mail, but it is also complex and can be difficult to configure. In recent years, there have been a number of newer mail filtering tools developed, such as Sieve and Maildir, which offer a more modern and user-friendly interface. As a result, Red Hat has decided to deprecate procmail in favor of these newer tools. If you are currently using procmail on RHEL 8, you should consider migrating to one of the newer mail filtering tools. Here are some of the newer mail filtering tools that you can consider:
  1. Sieve: A mail filtering language that is supported by a number of mail clients, including Evolution, Thunderbird, and Mutt.
  2. Maildir: A mail storage format that is supported by a number of mail clients, including Evolution, Thunderbird, and Mutt.
  3. ProcmailNG: A modern fork of procmail that offers a more user-friendly interface.

Testing email filters in procmail

The most straightforward way to test your filters is to send email to yourself, typing into the email the conditions you're filtering. This technique works if you're filtering an email based on its subject or contents.
You can send email to yourself from the Linux command line with the mail command. To use it, supply your username as the first argument, then enter the subject and body of the email. When you're finished composing the body, type a period (.) on a line by itself and enter any users to carbon copy, as in the example below:
[bishop@localhost bishop]$ mail bishop
Subject: this should be a filtered email
This email is about my credit card and making money fast! 

Cc: [bishop@localhost /home/bishop]# 
If all works as expected, you can check the filtered folder in your mail program. If the filtering didn't work as expected, then the email will appear in your Inbox. Note: If you receive an email that you might want to filter, save the email and set up your filter. Then use your mail program to bounce[1] the mail to yourself. When you bounce the mail, it will be as if you received the mail a second time, and you can check to see if your filter worked. This is by far the best, most accurate method to test your procmail filters.
In the next lesson, you'll learn how to troubleshoot procmail.

Testing Email Filters - Exercise

Before moving on to the next lesson, click the Exercise button to check your ability to test email filters.
Testing Email Filters - Exercise
[1]Bounce: To resend an email to another recipient, but retain the original email envelope. This makes an email you bounce to someone look as though he or she received it from the original sender.