procmail
[Top] [All Lists]

Please check my procmail recipe

1996-02-08 19:50:29
Hi, folks,

I'm new to procmail, and I have a somewhat complicated recipe to set
up.  Unfortunately, I don't have easy access to the procmailrc file to
just try things out, and it's for a fairly important situation where
we *really* don't want to lose any incoming mail.  I guess I'm just
paranoid, but I'd like to have someone who's actually ever written a
recipe before check this one before I install it.  The man pages are
great, but they can only do so much...

I'd greatly appreciate it if someone could look over my proposed
recipe and see if it does what I hope it does, and especially if I
have :c flags everywhere I need them.

Here's a pseudo-code desccription of what I think it's doing.

If the message is to "submit", not a loop, and not also sent to "queue",
{
        pass it to the file_message script
        also pass it to the save-faq program
        if save-faq exited with nonzero status
        {
                send the reply save-faq generated (in stdout)
                exit this recipe, but continue on to later recipes
        }
        otherwise
        {
                send the reply save-faq generated
                send the incoming mail to "queue"
                continue on to later recipes
        }
}

Now here's the mess of a recipe:

* ^TOsubmit
* !^TOqueue
* !^FROM_DAEMON
{
# pass message to file_message script
        : c
        |/usr/local/file_message  # I know this script iself works

# also pass it to save-faq script, and store output (stdout) in CHECK
        : c
        | CHECK="/usr/local/save-faq"
          if !$?  ; then          # check sh status var from save-faq
           # send a reply which contains output from save-faq
           (formail -rt -A [various handy headers] ; echo $CHECK ) \
                | $SENDMAIL -t
           #exit this script (jump down to the final } ), but not procmail
            exit 1
          fi

        # otherwise, save-faq was successful; again, send a reply with
        # its output -- this is repeated so !$? refers to the save-faq
        # command and not the formail
        (formail -rt -A [same handy headers] ; echo $CHECK ) \
                | $SENDMAIL -t  

        # if save-faq was successful, also pass this message to "queue"
        :a
        | (formail -t -i To queue) | sendmail -t   # send it to queue

}

# other recipes follow, including one which handles things sent to
# "queue" (like "submit", an alias to the account this procmailrc is for)

My thanks to anyone who takes the time to look this over!

--
- Pam Greene
Ferret Central <http://www.optics.rochester.edu:8080/users/pgreene/>
            or ftp to ftp.optics.rochester.edu and look in pgreene/
            or send INDEX FERRET in email to 
<listserv(_at_)cunyvm(_dot_)cuny(_dot_)edu>

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