Deprecated Behaviour

The inane, sometimes insane, ramblings from the mind of Brenton Alker.

Using Procmail to Apply Filter Mail Into Maildir Folders

This topic wasn’t on my “to do” list, but it came up. So here it is.

Use of procmail to filter emails is definitely not a new thing, that is what it does after all. But in my attempt to configure it, I found very little clear information about support for “Maildir” style delivery amongst the wealth of documentation on the subject.

The 2 main differences in a .procmailrc that works with Maildir, is the trailing slash on the MAILDIR value and the way target folders are specified.

eg. The start of my .procmailrc looks like this:

1
2
3
4
5
6
7
8
9


MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR

:0
* ^To:.*(@lists\.danga\.com)
.List/new

So, the 2 points to note, as I said are. The maildir path ends in “/” and the destination is a folder within the Maildir, which is a hidden directory with its own set of cur/new emails in it.

Thanks to procmail, I now only have one location to maintain my filtering rules. My email can then be accessed through IMAP from work, home, laptop and webmail without them being moved into the wrong folders.