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/
}
Share on LinkedInShare on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to redditShare via email

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>