Filtering email with filter(1)


Some time ago I was browsing through list of orphaned Debian packages^1. and encountered `filter` program with very promising description — "filter is one of the original mail filtering programs written for UNIX".

^1

It is much simplier than `procmail`, its manual page is *page*, not *manual*, while supporting almost anything I need:



^2


Syntax of `filter` rules is much less cryptic and less verbose, than one of `procmail`. Compare

if (subject = "Foo") then save "/tmp/foo.mbox"

with much more verbose `procmail` rule.

:0:

/tmp/foo.mbox

Unfortunately, `filter` does not provide equivalence of two features of `procmail`, that are significant to my email workflow:


incoming emails and adds *X-Spam-Level* header. My `procmail` configuration uses this header to classify messages as spam. Probably, I could run SpamAssassin locally, but why bother, if settings of my email provider are fine for me.


Both `filter` and `procmail` are long ~dead~ mature. Source code of `filter` is twice as short, if you care about such things. Half of that is regular expression engine, that is built it modern implementations of standard C library. Give `filter` a shot.

Definitely, `filter` would benefit from some care. Use standard regular expression engine, add support for *X-Spam-Level* header and here it is -- perfect email filtering solution. Maybe, one day, in my copious free time…