procmail
[Top] [All Lists]

Re: Matching regexps from a file?

1997-08-10 15:51:00
On Sun, 10 Aug 1997 15:03:17 -0500, areray(_at_)io(_dot_)com (Rocket Ray) posted
to procmail.list:
How would I write a condition line that would make Procmail check the
header lines of incoming mail to see if any of them matched any of the
regexps in the "keyfile" file?

man procmailrc

    :0:
    * ? grep -sf keyfile
    mysave

I filter all my lists on the From_ line -- you can run the headers
through formail first to control which fields grep gets to see: 

    :0:
    * ? formail -zx"From " | fgrep -sf $HOME/procmail/lists
    mysave

Just make sure you don't have any lists whose name looks like a date
stamp, or filter out the date stamp part from the From_ line :-)

For the truly brave, this is what I've been thinking about recently:

    FOLDER=`formail -zx"From " | join -t " " -o2.2 - $HOME/procmail/lists`

    :0:
    * FOLDER ?? .
    $FOLDER

where the lists file would contain a space-separated From_ field --
folder name mapping (and perhaps other fields, such as what I want to
call this folder when reporting there is mail in it, or xbuffy options
for it, or whatever). With a bit more work, this could in fact become
rather useful. 

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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