Tag Archives: procmail

Geeking out with 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/ }