procmail
[Top] [All Lists]

Re: newbie seeks yet more help

1997-05-29 13:19:00
On Wed, 28 May 1997 13:36:04 -0500 (EST), Barry <barry(_at_)gslink(_dot_)com>
wrote:
:0cw

(The w flag here is not doing anything, as far as I can tell.)

{
        MAILFROM=`formail -xFrom:`
        :0

(Since false ignores its standard input, you should probably have an i
flag here. Common wisdom says to also include an h flag on the theory
that you want to pipe as little as possible to a program which ignores
its input, and the headers are usually smaller than the body.)

        | false $MAILFROM
}
        :0 afw

(And here, I believe the f makes the w unnecessary, one way or another.)

        | formail -a "X-I-Know-This-Person: Yes"

(Step back and disregard the parenthesized comments.)

The problem here is that the c flag starts its own "branch", which
terminates at the closing brace, and the a flag thinks the branching
itself always succeeds, apparently. (In any case the final recipe in
the branch is not what the a flag considers the "immediately preceding
recipe".)

How's this:

    DOIKNOW=false
    MAILFROM=`formail -xFrom:`

    :0f
    * ? $DOIKNOW $MAILFROM
    | formail -a "X-I-Know-This-Person: Yes"

Do note that `formail -xFrom:` will return the whole From: field. This
is not necessarily an exact string match of what you might have in
your Pine address book. 
  (For this message, for example, I get " era eriksson <era(_at_)iki(_dot_)fi>",
leading space and all. The -z flag cures that but if you only have
era(_at_)iki(_dot_)fi in your address book, your program should of course be 
able
to cope with that as well. Or I might suddenly change the
idiosyncratic capitalization ... my University's software does what it
can to force me ;-)

Also, is there any way not to have the doIknow you action recorded in my
log?  I use mailstat in my .login and I'd rather not be reminded that all
my mails went through the doIknowyou program... I was looking for more of a
seamless transparent type of thing...

I believe this ought to take care of that as well. 

/* 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>