procmail
[Top] [All Lists]

Re: It Flat Doesn't Work!

1996-09-18 09:23:51
If you read the output from procmail carefully, you'll see that the
second line marked with "-->" has an escaped blank, which leads me to
suspect that you must have a trailing blank after the "\" on the
"formail" line (the first line marked with '-->').

    > I *can* successfully sort and forward incoming email to others.
    > I *can* successfully sort and forward incoming email to folders.
    > I *cannot* reply to an incoming email with a prepared file AT ALL.
    > 
    > Here is my .forward file:
    > 
    > "|IFS=' ' && exec /usr/local/bin/procmail -f- || exit 75 #kipstips"
    > 
    > Here is my .procmailrc file:
    > 
    > PATH=/usr/sbin:/usr/lib:/usr/bin:/usr/local/bin:/usr/contrib/bin
    > MAILDIR=$HOME/mail
    > LOGFILE=$HOME/.procmail/log
    > FILEDIR=$HOME/fserve
    > 
    > :0 w c
    > * ^Subject:.*1250
    > * !^FROM_DAEMON
--> > | ( formail -rI"Subject: EON 2000 Info"  \
    > -I"From: J.R. Stone <kipstips(_at_)io(_dot_)com>" ; cat $FILEDIR/info.txt 
) \
    > | $SENDMAIL -t
    > 
    > Here is what gets reported in my .procmail/log file:
    > 
    > >From eon2000(_at_)io(_dot_)com  Tue Sep 17 22:39:38 1996
    >  Subject: 1250
--> >   Folder:  ( formail -rI"Subject: EON 2000 Info"  \ -I"From: J.R. Stone   
  747

Here is an alternative recipe, which is a little "cleaner" in my opinion:

    # Auto-respond recipe, invoked only if:
    #  * The subject has a "1250" in it somewhere (you should consider
    #    making this a little more restrictive, like "send info 1250")
    #  * The mail isn't from a mailer-daemon
    #  * The mail isn't from this recipe (a loop)
    #  * The file to be forwarded is readable (always a good idea to
    #    make sure)

    :0 c
    * ^Subject:.*1250
    * !^FROM_DAEMON
    * $!^X-Loop: $LOGNAME(_at_)$HOST
    * ? test -r $FILEDIR/info.txt
    {   # procmail forks here -- the parent skips, and the child does
        # the forwarding

        # replace headers with a reply;
        :0fh
        | formail -rt   -I"From:    J.R. Stone <kipstips(_at_)io(_dot_)com>" \
                        -I"Subject: EON 2000 Info" \
                        -I"X-Loop:  $LOGNAME(_at_)$HOST"

        # replace the body (and ignore the current body)
        :0fbi
        | cat $FILEDIR/info.txt

        # Now forward the mail as directed by the reply headers
        :0
        ! -t
    }

If you copy this recipe (like using "cut n paste"), be *SURE* to edit
the text and make *SURE* that there are no characters after the "\"
except the newline.

G'luck.
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

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