Skip to Content

Posts Tagged ‘procmail’

procmail magic: I am not afraid of lists anymore

Permalink

Yesterday a number of list posts from lists I had forgotten to write a procmail rule for made their way into my inbox. I didn’t like the idea of adding yet more cookie cutter rules to my ever expanding .procmailrc to fix the issue so, I went hunting for a better solution.

After searching for a bit I found jdub’s procmail which got me most of the way there:

# MOST LISTS - Automagically handle lists
:0
* ^((List-Id|X-(Mailing-)?List):(.*[< ]\/[^>]*))
{
    LISTID=$MATCH

    :0:
    * LISTID ?? ^\/[^@\.]*
    ifup.$MATCH/

}

# MAJORDOMO - Automagically handle Majordomo lists
:0
* ^Sender:.*owner-[^@]+@[^@\+]+
* ^Sender:.*owner-\/[^@\+]+
{
    :0:
    ifup.$MATCH/
}

But, vger.kernel.org mailing lists have listname-owner instead of owner-listname so I wrote this:

# MAJORDOMO with inverse owner
:0
* ^Sender:.*-owner@[^@\+]+
* ^Sender:[     ]*\/[^@\+]+
{
    :0:
    ifup.`echo $MATCH | /bin/sed -e s/-owner//g`/
}

Does anyone know how to skip that sed call? I am not too terribly happy with it but it works.

Final result: 80 insertions, 116 deletions and it handles all of my lists- not just the ones that I remember to add. w00t