Note: I've updated this page a little bit, but it still describes the previous version of the filter. The new filter is quite similar to the old one, but has easier configurability, and is (by default) rather less aggressive.

Lasu's mail filters

This page explains how I use procmail to filter my mail. Perhaps the most interesting part is how I reject mail from strangers in order to avoid getting spammed. This is not an introduction to spam or why it's bad, or to procmail or mail filtering; see links at end for some suggestions, but I do assume you're able to implement the filtering on your own.

The approach

My filtering approach is like this:

  1. If the sender is on the blacklist, delete the letter.
  2. Put mailing lists in their own folders. This must be done correctly! Otherwise the mailing list mail is treated as junk e-mail.
  3. Put local administrative e-mail in its own folder. I administrate my own Linux box. This catches mail from system crontabs, news log summaries, and so on. (Maybe not relevant to you.)
  4. At this point, it should be personal mail. Check that the To or Cc headers address me. If not, delete the mail.
  5. Put bounce messages in their own mailbox.
  6. If the sender is on my whitelist:
    1. If I'm on vacation, send back automatic response.
    2. Put the letter in inbox.
  7. If the subject includes password, put in special folder for unknown people.
  8. Otherwise, autoreply with request to use password and delete the mail.

Instead of deleting the unwanted mail, it is also possible to just store it in a special folder. You should do this while testing the setup, so that you don't lose any important mail due to errors. It's best to use separate folders for each case; I have folders no-password and new-OTHER, but feel free to use other names.

When using this scheme, it is imperative to put all addresses you send mail to on your whitelist or else to put the password in the subject. Otherwise, you will annoy people. I have an automatic setup for the MH mailer.

Problems

My approach has some problems:

Alternative methods

Many ways to fight junk mail have been proposed. Below is a list of a few of them and the reasons why I don't do that.

Related links

Feedback

I'd be glad to hear any suggestions on how this filtering scheme can be improved. Don't hesitate to tell me if you have ideas on solving the above problems or if you can think of a new problem. I'd also be grateful if tell me if you use this filtering scheme so that I can tell you about important updates. I'd also like to hear of alternative filtering schemes, especially for people using non-Unix systems. Follow the link at the bottom before mailing, so you'll know how to avoid my filtering.

(22 September 1997, Lars Wirzenius)