procmail
[Top] [All Lists]

Re: Mis-information in procmailed?

1997-06-08 15:16:00
Luke Davis <ldavis(_at_)voicenet(_dot_)com> writes:
It can't be; thus my idea of how the software works is extremly wrong.:)

Extract from procmailex:

To store mail from Peter about Compilers in 'petcompile':

:0:
* ^From.*Peter
* ^Subject:.*Compilers
petcompile

Here's the problem I have with it:

Unless I miss my guess, the following message would also be stored in
petcompile:

From: Luke Davis <ldavis(_at_)dynanet(_dot_)com>
Subject: info about compilers:

Message-Text

I come up with that by the facts that the message has to match any *1* of
the afirmitive conditions, and will only be rejected if 1) it matches
*none* of the afirmitive conditions, and 2) does match any *1* of the
negative conditions.
If that's so, then any mail from peter, or any mail relating to compilers
*will* go in petcompilers...

I'm not sure how you came up with the reading above, but you have the
logic wrong: all the conditions must succeed.  Negated conditions are
just conditions that succeed iff the rest of that condition fails.

To quote the procmailrc(5) manpage:
        Conditions are anded; if there are no conditions the  result
        will be true by default.


I don't want to say the document is wrong; but for it to be right, I have
just spent a month writing a script to do server processing;for which I
will not be payd, because it won't work.:)

The document is correct, and you need to change your recipe(s).  You
can get the effect you desire by using deMorgan's laws (which have been
cited here at least half a dozen times in the last week, so pay attention
this time!) and using the following form:

        :0
        * ! one of these conditions
        * ! (ignoring the negations)
        * ! must be true
        { }
        :0 E
        * this condition must be true
        some-action-here

For example, with the recipe pair:

        :0
        * ! ^Subject:.*foo
        * ! ^To:.*someaddress
        * ! B ?? something-in-the-body
        { }
        :0 E
        * ^From:.*someone
        some-folder


A message will only be delivered to "some-folder" if the Subject: contains
"foo" OR the To: header contains "someaddress" OR the body contains
"something-in-the-body", AND (regardless of which of the previous was true)
the From: header contains "someone".


Philip Guenther

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