procmail
[Top] [All Lists]

Re: Problems changing "From:" in header of autoreply

2003-05-15 15:09:04
Thanks to all those who helped me with my autoreply question (above and
beyond the call of duty). Here is the recipe I've finally fashioned which
seems to function well, thanks to your advice and suggestions--for the
record:

#The following recipe replies to a defunct email
#address, tomwolfe(_at_)sawback(_dot_)com, with a message, 
#tomwolfe.txt, that tells the sender to use my
#current email address. It keeps track of who it's
#autoresponded to in ".greylist" which is periodically
#removed using a cron job. 

#tomwolfe autoreply

#get sender from FROM header using formail
FROM=`$FORMAIL -rt -xTo:`

#reply to mail to tomwolfe@
:0 c
* ! ? echo "${FROM}" | grep -F -isx -f ~/.greylist #check if sender is on 
greylist
* !^X-Loop: tomwolfe_reply
* !^Subject: *(Re|Fwd?):
* !^FROM_DAEMON
* ^To:(.*\<)?tomwolfe@
| ($FORMAIL -rt \
     -A"Precedence: normal (autoreply)" \
     -A"X-Loop: tomwolfe_reply" \
     -I"From: tomwolfe Autoresponder<auto_tomwolfe(_at_)sawback(_dot_)com>"; \
     cat ${REPLIES}/tomwolfe.txt) \
| $SENDMAIL -t

# save FROM address into greylist if not already there
:0 Wic : ~/.greylist.lock
* !^X-Loop: tomwolfe_reply
* !^Subject: *(Re|Fwd?):
* !^FROM_DAEMON
* ^To:(.*\<)?tomwolfe@
* ! ? echo "${FROM}" | grep -F -isx -f ~/.greylist
| echo "${FROM}" >> ~/.greylist

:0 #trash it
* !^X-Loop: tomwolfe_reply
* !^Subject: *(Re|Fwd?):
* !^FROM_DAEMON
* ^To:(.*\<)?tomwolfe@
/dev/null

#End tomwolfe section

The only problem I've had is in dealing with deflected admin emails to
non-existent (spamming) senders. I've solved this problem (sort of) by
trashing returned emails that bear a part of the tomwolfe.txt file, since
most returned email messages contain at least a part of the original
email. This may be a bit of a jerry-rigged solution but, hey, I'm just a 
newbie.

Regards,
Tom Wolfe

-- 



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail