procmail
[Top] [All Lists]

Re: Autoresponder Question

1997-01-19 19:12:21
On Sun, 19 Jan 1997, Keith Middlekauff wrote:
great! My question is: Can I modify this rule to not only send
the reply to the requester but also send an e-mail to the owner
of the responder that would let them know who just requested
info from the autoresponder.
(var.s deleted)
:0
* ^TOcompound(_at_)bizopsmall(_dot_)com
*!^FROM_DAEMON
*!^X-Loop: compound(_at_)bizopsmall(_dot_)com
|(formail -r -A "Precedence: junk" \
-I"From: Auto Reply from bizopsmall <compound(_at_)bizopsmall(_dot_)com>" \
-I"Subject: Information Request" \
-A "X-Loop: compound(_at_)bizopsmall(_dot_)com";\
cat $FILEDIR/bizops/compound )|$SENDMAIL -t 
-fcompound(_at_)bizopsmall(_dot_)com

Several ideas spring to mind. One way would be to simply forward a
copy of just the header of the request to the owner at the owner's
address of choice. If it is the same as the autoresponder, then we
process through formail first. (Prudence would require the X-Loop
being added regardless of destination, I suppose.)

:0ch
* ^TOcompound(_at_)bizopsmall(_dot_)com
*!^FROM_DAEMON
*!^X-Loop: compound(_at_)bizopsmall(_dot_)com  
| formail 
-A"Resent-From: Auto Reply from bizopsmall 
<compound(_at_)bizopsmall(_dot_)com>" \
-A "X-Loop: compound(_at_)bizopsmall(_dot_)com" ; \
echo "$FILEDIR/bizops/compund" ; \
| $SENDMAIL owner's-address-here

:0A
|(formail -r -A "Precedence: junk" \
-I"From: Auto Reply from bizopsmall <compound(_at_)bizopsmall(_dot_)com>" \
-I"Subject: Information Request" \
-A "X-Loop: compound(_at_)bizopsmall(_dot_)com";\
cat $FILEDIR/bizops/compound )|$SENDMAIL -t  
-fcompound(_at_)bizopsmall(_dot_)com

The first recipe clones the mail, matches the conditions, adds the
"X-Loop:" field, and mails it to the owner. In the body of the message
sent to owner, I put in an echo statement that should echo the
filename requested. That may be unnecessary for your purposes.

The second recipe is totally dependent on the conditions in the first
due to the 'A' flag, so it doesn't need conditions. It takes the copy
passed from the first and processes as before. 

The above method may be especially useful if the files requested vary,
and the request is contained in the "Subject:" field. This makes it
simple for the owner to process with formail to extract requester's
address and the name of the file requested for a log, rather than just
filing the whole message. Procmail processing of the mailed notices by
the owner into a log would be a good idea, since the owner's mailbox
could get a lot of mail in a hurry and overflow.

If you're looking for a more useful variation than the above, write me
and I'll give it my best. :-) And please read and heed the advice of
the more experienced on this list. I'm new at this! Procmail is very
flexible and provides more than one way to do the same thing.

David

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