procmail
[Top] [All Lists]

Re: Problem With Auto-Responder

1996-08-20 23:08:08
Mike Kercher <mike(_at_)ThePeoplesNetwork(_dot_)Net> writes:
The following .procmailrc was working fine with the very first entry.
Tonight, I tried adding some more entries to the rc file and now, none
of my new entries will work.  The first still works fine.  Where did I
go wrong?

You forgot to fix the space bar on your keyboard.


VERBOSE=off

And here's your other bug.  'Scuse the shouting, but

****IF IT DOESN'T WORK, TURN ON VERBOSE LOGGING AND READ THE LOG****

Actually, have you looked at the log at all?  Last time I checked,
procmail logged a warning or error message when it hit a syntax error
in my .procmailrc

...
:0 ic
* ^TOtpn-robot
*!^FROM_DAEMON
*!^X-Loop:flaq(_at_)synwork(_dot_)com
|(formail -r -a "Precedence: junk"\
-I"From: Auto Reply from The Peoples Network
<tpn-robot(_at_)ThePeoplesNetwork(_dot_)Net> " \
-I"Subject: Automated Response For Information" \
-A "X-Loop: flaq(_at_)synwork(_dot_)com";\
cat $FILEDIR/info.txt ) |$SENDMAIL -t

There are two critical space missing in the above recipe (as well as the
following one).  Namely, there should be a space after the colon in the
X-Loop: condition and there should be a space before the backslash on the
first line of the action.

Most importantly however, there's a backslash missing from the second line
of the action.  That's what's choking procmail.  You'll need to fix that
in all your recipes.

If you examine your logfile, this error should be fairly obvious, as procmail
will have been truncating the command.


If you're going to be making several of these autoreplies that all are
basically the same, then perhaps you should move the real code into a
seperate procmail recipe file which you can then treat as a subroutine.

In particular, if you were to create a file $HOME/.procmail/autoreply
(i.e., $PMDIR/autoreply) that contained the following:


:0 ic
* $ ^TO$address
* ! ^FROM_DAEMON
* ! ^X-Loop: *flaq(_at_)synwork(_dot_)com
| (formail -r -a "Precedence: junk" \
        -I"From: Auto Reply from the Peoples Network \
                <$address(_at_)ThePeoplesNetwork(_dot_)Net>" \
        -I"Subject: $subject" \
        -A"X-Loop: flaq(_at_)synwork(_dot_)com"; \
   cat $FILEDIR/$file ) | $SENDMAIL -t


(Note carefully that *every* action line except the last ends in a
space, followed by a backslash, even the one which is breaking up the
From: header.  procmail will strip the leading whitespace (which shows
the logical grouping in the above), then remove each backslash-newline
pair.  There's one one space between the work "Network" and the '<' in
the From: line when the formail command is run.)


Then to use this, just put in your .procmailrc:


address   = tpn-robot
subject   = "Automated Response For Information"
file      = info.txt
INCLUDERC = $PMDIR/autoreply


The second recipe would become:


address   = infomenu
subject   = "TPN E-Mail On Demand Menu"
file      = infomenu
INCLUDERC = $PMDIR/autoreply


Is that simple enough?  What can I do to convince you of the benefits of
whitespace?


Philip Guenther

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