To all:
I am trying to send a file as a reply to some of the Email that I
receive. I tried to write the scripts based upon the scripts that I
received from Philip Guenther's Library. Could someone please help me
debug them so that they will work? This is my first attempt. The files
are attached.
Also where can I find documentation that explains all the commands?
Thanks,
Patty Buchanan
First file that procmail goes to: rc.testing
:0:
{ * ^Subject:.*test
IN.testing
}
:O
* ^Subject:.*coupon
{
INCLUDERC=$HOME/.procmail/reply-file.rc
}
SHAR_EOF
Second file: reply-file.rc
:O
* ? test -f commands.rc.log
{OLDCMDLOGFILE=$LOGFILE
LOGFILE=commands.rc.log
LOGABSTRACT=all
VERBOSE=yes
}
:O
* ^Subject: .*['"]?\/\
(Send|get) + (coupon)
* ! ^From_Daemon
* $ ! ^X-Loop: $MY_ADDR
{
COMSAT=off
DELIVERED=yes
:O c:
* LOGFILE ?? commands\.rc\.log
commands.requests
SUBJ=$MATCH
:O
* ! ^Reply-to: *\/[^ }.*
* ! ^From: *\/[^ ].*
* ! ^Sender: *\/[^ ].*
* ! ^From *\/[^ ]+
{ FROM=nobody }
:OE
{ FROM=$MATCH }
FROMSIG="${FROMSIG-\"The Mailer-Daemon of $USER\" <$USER>}"
MY_ADDR='${MY_ADDR:-<$USER>}"
COMMANDLOG=${COMMANDLOG:-commands.log}
:O fhw
| formail -rI"From: $FROMSIG"\
-I"Reply-To: $MY_ADDR"\
-I"Subject: Re: $SUBJ"\
-I"Precedence: junck"\
-I"X-Loop: $MY_ADDR"
:O fbw
| echo "This message was sent automatically in response to your recent: ; \
echo "mail with the subject: \"$SUBJ\"." ; \
echo " "
:O
* SUBJ ?? coupon
{
REPLYFILE=$HOME/coupon/coupon-list
INCLUDERC=$HOME/.procmail/comm-reply-file.rc
}
:O cw
* > 1
! -oi -t
LOGABSTRACT=off
:O hw: $COMMANDLOG$LOCKEXT
| echo " date : $FROM : $SUBJ" >>$COMMANDLOG
:O
* LOGFILE ?? commands\.rc\.log
{ LOGFILE=$OLDCMDLOGFILE
LOGABSTRACT=yes
VERBOSE=no
}
SHAR_EOF
Third file: comm-reply-file.rc
:O
* ! REPLYFILE ?? .
{ LOG="comm-send-file.rc: REPLYFILE not defined!
"
}
:O E
{
:O fbw
* ? test -f $REPLYFILE
| cat - $REPLYFILE
:O E
{
:O
* ! REPLYERR ?? .
{
:O
* ! REPLYFILE ?? .*/\/[^/]+$
* ! REPLYFILE ?? \/^.*$
{ REPLYERR="Sorry, the file you requested is not currently available."}
:O E
{ REPLYERR="Sorry, the file '$MATCH' is not currently available."}
}
:O fbw
| cat - ; echo "$REPLYERR"
}
}
SHAR_EOF