x
Loading
 Loading
Hello, Guest | Login | Register

More Mail Filtering with procmail

Welcome to the fourth and final installment of our look at administering electronic mail. Last month, we began talking about procmail, a powerful general purpose mail-filtering facility, and its ability to sort (and possibly reject) incoming messages based on any criteria you desire. This month we’re going to look at some more advanced uses of procmail, such as identifying spam messages and scanning incoming mail for viruses.

Welcome to the fourth and final installment of our look at administering electronic mail. Last month, we began talking about procmail, a powerful general purpose mail-filtering facility, and its ability to sort (and possibly reject) incoming messages based on any criteria you desire. This month we’re going to look at some more advanced uses of procmail, such as identifying spam messages and scanning incoming mail for viruses.

Using procmail to Discard Spam

In order for procmail to successfully identify spam messages, you must be able to describe the characteristics of the messages you want to treat as spam and then write recipes accordingly.

Let’s take a look at several recipes that may be useful as models of handling spam. They happen to come from my own .procmailrc file, and so are applied only to my mail. As an administrator, you can choose to deal with spam at several levels: through the transport agent (e.g., checking against blacklists), at the system level, and/or on a per-user basis. In the case of procmail-based filtering, anti-spam recipes can be used in a system-wide procmailrc file or made available to users wanting to filter their own mail.

The following recipe is useful at the beginning of any procmail configuration file, as it formats mail headers into a predictable format:

# Make sure there’s a space after header names :0fwh |formail -z 

The next two recipes provide simple examples to one approach to handling spam:

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. KDE 4.4: Does It Work Yet?
  2. Writing Custom Nagios Plugins with Python
  3. Power Up Linux GUI Apps
  4. Tweeting from the Command Line with Twyt
  5. When Memory Serves You: Using ramfs and tmpfs
Follow Linux Magazine
Rackspace