procmail
[Top] [All Lists]

Re: Procmail Errors

1999-02-27 02:19:13
On Fri, 26 Feb 1999 22:41:34 -0500, Christopher Neill
<chris(_at_)verio(_dot_)net> wrote:
On Fri, Feb 26, 1999 at 03:49:39PM -0700, deedsmis(_at_)ris(_dot_)net wrote:
And, exactly how are the "{}" braces used, what purpose do the
serve, and how effective are they?
Those are for nesting actions, since a recipie only contains one action:
:0
* ^FROMBob Allistat
{
     :0
     EXITCODE=67 HOST
     !steele(_at_)fbi(_dot_)gov`
}

One: There is no ^FROM macro.
Two: The syntax in the inner recipe is wrong on three points.
    Basically, this would save the message to a file called
    EXITCODE=67 and then exit. 
Three: "Allisat" contains only one t.

Syntax corrected:

    :0
    * ^(From|Sender:).*Bob Allisat
    {
        :0   # Bug remains here
        { EXITCODE=67 HOST }

        :0
        ! stele(_at_)fbi(_dot_)gov
    }

However, Procmail would exit immediately when you start tricking with
HOST -- that's the reason you use this idiom -- and so a copy would
never have been forwarded to the FBI. 

Perhaps this would be a better illustration:

    :0
    * ^(From|Sender:).*Bob Allisat
    {
        EXITCODE=67
        :0
        ! steele(_at_)fbi(_dot_)gov
    }

Here, you do two things when the condition matches: Set EXITCODE
(meaning you will be communicating an error condition back to the MTA,
which will produce a bounce message if things work out as expected),
and forward to the FBI guy. Procmail will exit upon successful
delivery but the EXITCODE will remain set to what we specified. No
need to trick with HOST (which is a trick you should explain if you
use it in examples anyway).

From|Sender is just a rough approximation of what you might expect
^FROM to accomplish if it existed. See the documentation for ^TO_ to
get an idea of what you could be checking against.

Hope this helps,

/* era */

-- 
.obBotBait: It shouldn't even matter whether    <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>

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