procmail recipe

justin at shiningsilence.com justin at shiningsilence.com
Sun Mar 6 14:03:16 PST 2005


> I've tried working out a procmail recipe, but this one is tough. I think
> it requires a separate program to do the second check but I'd like to
> figure a way to do it on a (procmail) command line. Either way someone
> what to give a shot?
>
> Plan: deliver list postings from specific addresses to a special
> maildir, and also deliver any list postings that are replies to those
> address to the special maildir.

This is a shortened version of what I had working for my first draft of
the mail archive for the lists, before I switched to pulling the entries
from the news server.

You will need to define $PATH as the path to your maildir directories. 
The script will create the directory for each list as "docs", "bugs", etc.
 If you want different names, there's a trick to automatically reassign
the names that I can dig up.

To be safe, stick some mail messages into individual files and give this a
manual test from the command line.

:0
* ^TO_\/(bugs|commits|docs|kernel|submit|test|users)@dragonflybsd.org
* MATCH ?? ()\/[^@]+
{
        # find what list this is going to
        LISTNAME=$MATCH

        # create destination dir if needed
        :0 c:
        * $ ! ? test -d $PATH/$LISTNAME
        | mkdir $PATH/$LISTNAME

        # archive in appropriate mbox file
        :0 c:
        $PATH/$LISTNAME/
}







More information about the Users mailing list