TannieSpace

geekery, drawing and then some

Posts about procmail

Geeking out with procmail

I love procmail, not sure why I prefer it over other options, but I do. Recently I’ve found / figured out a few nice rules to help automate filtering a bit.

The following rule checks for the existence of various headers usually used by mailing-list and filters the mail into a mailbox with the list’s name:

:0
* ^((List-Id|X-(Mailing-)?List):(._[< ]\/[^>]_))
{
    LISTID=$MATCH
    :0
    * LISTID ?? ^\/[^@\.]*
    .$MATCH/
}

Some mailing-lists don’t have a ‘List-Id’ and such, but they do have a ‘Sender’. For these I use:

:0
* ^X-BeenThere:.*
* ! ^(List-Id|X-(Mailing-)?List):.*
* ^Sender: \/[^@-]+
.$MATCH/

For a lot of webforms I use an address with a ‘+’ in (a completely valid symbol in an e-mailaddress btw). If I’d need to use an address for say, google.com, I’d fill in ‘tannie+google@tanniespace’ (and .com ofcourse). To filter out these addresses to their own folder I use the following rule:

:0
* ^TO._+\/([a-z]._)\@(mydomain|otherdomain)
{
EXTENSION=$MATCH
:0
* EXTENSION ?? ^\/[^@.]*
.$MATCH/
}