procmail
[Top] [All Lists]

punting html with a warning

2002-01-02 13:47:12

someone was looking for a way to punt html mail but send a message
saying why  - this seems to work

Scott

-----------
# deal with html mail
# reject all html mail with an explanation

# set up a temporary file
TEMPORARY=/tmp/pmail.$$
TEMPORARY1=/tmp/pmail1.$$   
TRAP="/bin/rm -f $TEMPORARY TEMPORARY1"

:0 Whc
# look for html content type
* ^Content-Type: text/html
# Perform a quick check to see if the mail was addressed to us
* $^To:.*\<$\LOGNAME\>
# Don't reply to daemons and mailinglists
* !FROM_DAEMON
# escape from mail loop
* !^X-Loop: me(_at_)my(_dot_)address
# do just once per person
| formail -rD 8192 html.cache

# come here if the source was not in the cache
:0 ehc 
   {
   # copy the explanation to the temp file and
   # append the mail shifted over one space
   :0 c
   | sed -e 's/^/ /' >> $TEMPORARY ;\
         cat $MAILDIR/html.explain $TEMPORARY > $TEMPORARY1 ;\
         /bin/rm -f $TEMPORARY

   # send back the message  
   :0 c
   | (formail -r -I"Precedence: junk" \
         -A"X-Loop: me(_at_)my(_dot_)address" ; \
         cat $TEMPORARY1 ;\
         ) | $SENDMAIL -oi -t

   # wait until above finishes then remove temp file
   :0 ac
   | /bin/rm -f $TEMPORARY1 ;
}

# finally discard the html mail
:0
* ^Content-Type: text/html
discard
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • punting html with a warning, Scott Bradner <=