procmail
[Top] [All Lists]

Maintaining variables across forked procmails

1996-01-01 03:04:06
Okay, here's my problem. All mail addressed to 'sub-rosa.com' comes
into my mailbox, and is processed by procmail. Depending on the
contents of the To: and Cc: headers, the mail is forwarded to various
people, and run through various autorepliers, etc.

I do several nested blocks with the 'c' flag -- the mail may trip one
or more of the blocks. What I want to do is to this: if _all_ of the
processing recipies fail, I want a copy of the mail saved to my
mailbox. However, if the mail falls through to the end, and it has
already been processed by one or more of the recipies, I want it
deleted. I've gotten this far:

:0
* ^TO(sub-rosa\.com)
* ^Received: from .*c2\.org .*by .*netaxs\.com
* ! ^X-Loop: grendel(_at_)netaxs(_dot_)com
{
    PROCESSED = FALSE
    VALIDUSERS = 
(h[ae]ndl[ae]r|gr[ae]nd[ae]l|postmaster|root|admin|usenet|mike|anonymous|da?emon)

    :0 c
    * ^TOerotica-faq(_at_)sub-rosa\(_dot_)com
    * ! ^FROM_DAEMON
    {
        PROCESSED = TRUE

        :0c:erotica-faq.log.lock
        | echo "`date` :$FROM" >> $HOME/erotica/faq/erotica-faq.log

        :0
        | auto-reply $HOME/erotica/faq/FAQ.automail
    }

    :0 c
    * ^TOerotica(-request)?(_at_)sub-rosa\(_dot_)com
    {
        PROCESSED = TRUE

        :0 c
        * ^TOerotica(_at_)sub-rosa\(_dot_)com
        | auto-reply $HOME/erotica/automail/auto-ack

        :0:
        $HOME/erotica/mailbox
    }

    :0 c
    * ^TO(lamotte|ava)@sub-rosa\.com
    {
        PROCESSED = TRUE

        :0
        ! -oi lamotte(_at_)netaxs(_dot_)com
    }

    :0 c
    * $ ^TOhillary(_at_)sub-rosa\(_dot_)com
    {
        PROCESSED = TRUE

        :0
        ! -oi hillary(_at_)misty(_dot_)com
    }

    :0 c
    * $ ^TO $VALIDUSERS
    {
        PROCESSED = TRUE

        :0:
        $ORGMAIL
    }

    :0:
    * PROCESSED ?? FALSE
    $ORGMAIL

    :0h
    /dev/null
}

The problem is that the processing recipies set PROCESSED to TRUE, but
they're clones of procmail invoked by the 'c' flag. So, the master
copy of procmail, which processes the recipie that checks for the
PROCESSED flag, never gets its copy of PROCESSED set to TRUE.

Any suggestions on how I could rewrite this so that I can perform that
kind of checking? 

BTW, the success or failure within the nested blocks is unimportant. I
simply want the next to last recipe to know if any of the previous
recipes have been tripped.

Thanks in advance.

Michael

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