procmail
[Top] [All Lists]

Re: Catch-all list filter

2008-01-03 02:37:43
Hi,


In message <477C179E(_dot_)4050504(_at_)dd-b(_dot_)net>,
        David Dyer-Bennet (dd-b(_at_)dd-b(_dot_)net) wrote:
I'm trying to write a catch-all filter that will use the information in 
the List-ID: header to automatically make a folder for lists that show 
up in my inbox.  (Yeah, I know some spam might either accidentally or 
intentionally have such a header; this comes after my anti-spam stuff so 
I don't care too much.)  And yeah, some lists don't have that header, 
but this will automate much of the list folder creation process for me, 
and I'll feel less bad about handling the exceptions manually.  And if I 
find common exception cases, I can automate them some other way.

Anyway, what I'm trying so far is:


    :0
    * ^List-Id: \/.*$
    {
        gname=` echo $MATCH | tr -d '<>' | tr -t '. /' '_' `
        LOG="gname $gname
    "

You have already had a action for this recipe, so you need to start a
new recipe before your second action.

          :0
        .Auto.$gname/
    }

Your echo/tr/tr system may work, but an all procmail solution may be
better.  There have been a number of solutions to the "filing list mail"
problem posted to this list in the past so it is worth searching the
archives.  My own solution is as follows:

    :0
    * 9876543210^0 ^List-Id:.*<?\/[a-z0-9_-]+[.]
    * 9876543210^0 ^List-Post:.*<?\/[a-z0-9-]+[(_at_)]
    * 9876543210^0 ^Delivered-To:.*<?\/[a-z0-9-]+[(_at_)]
    {
        :0
        * MATCH ?? ^^\/[a-z0-9_-]+
        { LISTNAME = $MATCH }

        # special processing for mailman messages (e.g. monthly
        # subscription reminders) removed from here to simplify example

        :0
        $LISTNAME/
    }

This handles all but one of the over fifty mailing lists I receive mail
from.

I hope this helps.


Cheers,
       Nick.
-- 

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>