procmail
[Top] [All Lists]

Catch-all list filter

2008-01-02 16:02:51
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
    "
        .Auto.$gname/
    }

I'm getting the following log entries:

    gname discussion of the procmail program procmail_lists_RWTH-Aachen_DE
    procmail: Skipped ".Auto.$gname/"


The first seems to show that my echo / tr / tr pipeline is doing what I 
wanted, *except* that for some reason it's not turning the blanks into 
undersores (there's a blank between the '.' and the '/' in SET1 of the 
second tr in the pipeline; SET2 is a single underscore).  So I dunno 
exactly what's wrong there, but I can play with it offline, and I don't 
think it has anything to do with procmail or why my rule is failing.  
But I mention it in case I'm wrong and it's a flare-lit clue to somebody 
here.

The second seems to show that I'm somehow confused at a very basic level 
on how to write out messages into a Maildir.  (The weird 
".Auto.<whatever>/" format seems to be what thunderbird and the Imap 
server at Dreamhost.com need to give me subfolders of a folder Auto; it 
works with ".Lists.Debian/" and so forth from my manual per-mailing-list 
recipes. ) I know I can use variable substitution  in action lines -- 
the standard $HOME/Maildir/ thing depends on it.  The docs seem to say 
that Procmail will auto-create a maildir for an action line; but am I 
right about that?  Or is that the problem?  The message "Skipped" is 
just slightly short on useful information (at least it told me which 
action line it skipped; but I'd find *why* useful too).

-- 
David Dyer-Bennet, dd-b(_at_)dd-b(_dot_)net; http://dd-b.net/
Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/
Photos: http://dd-b.net/photography/gallery/
Dragaera: http://dragaera.info

____________________________________________________________
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>