Home page of "filter", the email filtering program

This is the official page of "filter", an email filter program used to take your incoming email, and automatically sort it, based on criteria like who sent it, and what the subject line is. It runs on UNIX machines, and other machines with a similar email distribution system.

Filter is different from procmail, in that it uses english commands. For example:

from = "bugs@debian.org" then save /home/bolthole/debian-bugs
to = "mailings@bolthole.com" then execute  "/home/bolthole/bin/redistribute"

"filter" was originally distributed with "elm", a text-based mail reading program that runs on almost any platform. It now compiles and runs without requiring elm. v2.4 and newer will look in $HOME/.filter for "filter-rules"

Latest official release: filter2.6.3.tar.gz (Dec, 2004) (Configure typo fixed)

NOTE: v2.4 and later uses $HOME/.filter/, not $HOME/.elm/ any more!

Bug Fixes and feature changes

Let me know if there are problems, and I will fix them! :-)

2.6.1: fixed buffer overflow problem in save_embedded_address()

Added in 2.6: a "from" rule will match "From ",From:,Reply-To:, Sender: independantly. Previously, the last header of those four would be the only one to be checked.

Added in 2.5.1: iso-xxxx-xxx binary de-encoding for subject lines.

Added in 2.4.2: The "lines" compare now works again, I hope.
You can now ditch all email longer than 1000 lines, for example.

Added in 2.4: resend and mailinglist

Fixed since 2.2: executec and forwardc

Fixed since 2.1:
There previously was a problem compiling under RedHat.
There previously was a problem compiling under Debian.

Changes from ELM-bundled filter

Version 2.x of filter has some bugs cleaned up from the prior elm-bundled one [considered as filter1.x]. For example, it can now handle unlimited numbers of 'to' addresses. Also, if you run filter setgid, you are strongly encouraged to upgrade to the latest version, for security reasons.

Version 2.1+ allows filter to recognize a different type of "mailbox" path. It defaults to something like /var/mail/%u but you can tell it that email gets delivered to users home directories by specifying /home/%u/inbox or something similar.


Installing filter for your personal email

If you are paranoid about always getting your email, you might make a backup of all your email for a while until you are happy with your filter configuration. Backups are done by putting

/path/to/backupmbox,"|filter"

in $HOME/.forward, instead of only sending to filter.
Dont forget to periodically clean out your backup mailbox!

For some more detailed information about filter, you can download the source, and look in the "doc" directory.

You will need a compiler (like gcc) to compile filter, before installing. Dont worry, it's pretty painless. Just run "./Configure", after extracting it from the gzip'd, tar'd archive, and press 'return' a bunch of times!

Some filter tips

This section may grow over time.
Generally speaking, avoid using the delete rule, and save junk, to a junk folder which you should scan through from time to time. Otherwise, you WILL lose email that you would want to read.

What with all the irritating f.a.k!e.sub.jec%t_LI#nes these days, a hopefully useful new feature is the alphasubject virtual header field. It forces the subject line to lower case, and removes all punctuation. A very useful rule is as follows:

#Delete the really obvious stuff
alphasubject ~= /pen[i1l]s/ then delete

Transparent forwarding

There is a new directive in filter2.4 for "transparently" resending an email to another account. It is called, appropriately enough, 'resend'. However, if for whatever reason it does not treat the headers like you want, then you can always call sendmail or your local MTA directly, as follows:

 if (to = "special@addr.com") then exec "/usr/lib/sendmail outside@addr.here"
Note that you MUST QUOTE "" the stuff after exec.


For filter questions or feedback, please email filter [at] bolthole.com