From violet@torithoughts.org Sat Aug 4 10:42:21 2001 Date: Sat, 24 Mar 2001 16:17:02 -0800 From: violet@torithoughts.org To: smartlist@lists.RWTH-Aachen.DE Cc: Werner Reisberger Subject: Re: html attachments Werner wrote: >I want to remove html attachments from postings but the links in the FAQ >don't work and seems to be quite old. > >Could someone give me a working solution for the removal of this garbage? Below is the recipe I use. I got it from the FAQ a couple of years ago and it has always worked beautifully for me. It rejects several types of submissions (we are working on refining the quoting recipe, as the one included here is too basic for us, but that shouldn't matter for your purposes -- if you only want to reject HTML attachments, just remove the recipe bits you don't need). I am also including the quotereject and rejectmsg files so you can use their structure if you want, but these have been customized for my lists so you'll need to alter them to suit you. Hope this helps. Violet xoxox # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # This script rejects messages in HTML, messages with a Return-Receipt # request, uuencoded messages, winmail.dat files, non text encoded # files, attached applications, inline attachments, and messages # which have too much quoted text. To activate it, uncomment the # RC_LOCAL_SUBMIT_00 = rc.local.s00 line in rc.custom file and # make sure the "quotereject" and "rejectmsg" files are in the list's # folder. #$Id: rc.local.s00,v 1.2 1994/09/20 19:33:28 berg Exp $ # # This file contains several examples of how you can customise SmartList # through the RC_LOCAL_SUBMIT_00 hook. # # to kill messages that ask for a "Return Receipt". Lotus Notes # will reply dutifully but in a misconfigured way, to the addresses # in the "To:" header :0 Hhw * ^Disposition-Notification-To: { :0 c | formail -i "Subject: ***asking for Return Receipt"|$SENDMAIL -oi $maintainer :0 | rejectmsg -receipt } # from a suggestion by Tim Pierce # below was "* ^begin [0-7][0-7][0-7] .*" :0 hBHw * ^begin [0-7][0-7][0-7] [a-zA-Z0-9_.-]+ { :0 c | formail -i "Subject: ***uuencode or winmail.dat***warning"|$SENDMAIL -oi $maintainer :0 | rejectmsg -attach } :0 hBHw * ^Content-Type:[ ]+.*(multipart/|/enriched|/html|coded) { :0 c | formail -i "Subject: ***encoded REJECT engaged by admin********"| $SENDMAIL -oi $maintainer :0 | rejectmsg -attach } :0 hBHw * ^Content-Type: application.* { :0 c | formail -i "Subject: ***content REJECT engaged by admin*********"| $SENDMAIL -oi $maintainer :0 | rejectmsg -attach } :0 hBHw * ^Content-Disposition: attachment.* { :0 c | formail -i "Subject: ***attachment REJECT engaged by admin*********"| $SENDMAIL -oi $maintainer :0 | rejectmsg -attach } :0 hBHw * ^Content-Disposition: inline; filename=.* { :0 c | formail -i "Subject: ***inline attachment REJECT engaged by admin********"| $SENDMAIL -oi $maintainer :0 | rejectmsg -attach } # mine (admin@torithoughts.org) :0 hBHw * 20^1 ^> * -10^1 ^[^>] { :0c | formail -i "Subject: ***quote REJECT engaged"| $SENDMAIL -oi $maintainer :0 | quotereject -attach } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # This is the rejectmsg file #! /usr/bin/ksh : test=test # /bin/test echo=echo # /bin/echo cat=cat # /bin/cat sed=sed # /bin/sed grep=grep # /bin/grep date=date # /bin/date formail=formail # /usr/local/bin/formail multigram=multigram # ../.bin/multigram $test -z "$listaddr" && $echo "Don't start this script directly, it is used in rc.local.s00" && exit 64 tmprequest=tmp.request tmpfrom=tmp.from function=$1 $cat > $tmprequest sender=`$formail -rtzxTo: < $tmprequest` case $function in -attach) ($formail -i"From: $listreq" -rtA"X-Loop: $listaddr" < $tmprequest ;\ $echo "Your post to the mailinglist appears to contain an attachment or" $echo "enriched text. Such posts are not accepted on this mailing list." $echo " " $echo "Please resubmit your post as a plain text document. " $echo " " $echo "Contact if you have any questions." $echo " " $echo " " $echo "[----------- ORIGINAL MESSAGE FOLLOWS -------------]" $echo " "; cat $tmprequest)\ | $SENDMAIL $sendmailOPT $sender shift ;; esac case $function in -receipt) ($formail -i"From: $listreq" -rtA"X-Loop: $listaddr" < $tmprequest ;\ $echo "Your post to the mailinglist appears to contain a request" $echo "for a Return Receipt." $echo " " $echo "Such posts are not allowed on the list as they have a tendency" $echo "to cause a loop condition." $echo " " $echo "Please resubmit your post without the Return Receipt request." $echo " " $echo " " $echo "[----------- ORIGINAL MESSAGE FOLLOWS -------------]" $echo " "; cat $tmprequest)\ | $SENDMAIL $sendmailOPT $sender shift ;; esac # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # This is the quotereject file #! /usr/bin/ksh : test=test # /bin/test echo=echo # /bin/echo cat=cat # /bin/cat sed=sed # /bin/sed grep=grep # /bin/grep date=date # /bin/date formail=formail # /usr/local/bin/formail multigram=multigram # ../.bin/multigram $test -z "$listaddr" && $echo "Don't start this script directly, it is used in rc.local.s00" && exit 64 tmprequest=tmp.request tmpfrom=tmp.from function=$1 $cat > $tmprequest sender=`$formail -rtzxTo: < $tmprequest` case $function in -attach) ($formail -i"From: $listreq" -rtA"X-Loop: $listaddr" < $tmprequest ;\ $echo "Your mail to the mailing list has been intercepted and is being" $echo "returned to you because it appears to contain an excessive" $echo "amount of quoted material." $echo " " $echo "Quoting should be done only for context. It is a waste of space" $echo "and resources to quote messages in their entirety, or to quote" $echo "message headers or signature files." $echo " " $echo "Please edit the amount of quoting in your message and send it" $echo "again." $echo " " $echo "If you need help, you may contact the maintainer by sending " $echo "a message to " $echo " " $echo " " $echo "[----------- ORIGINAL MESSAGE FOLLOWS -------------]" $echo " "; cat $tmprequest)\ | $SENDMAIL $sendmailOPT $sender shift ;; esac # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _______________________________________________ Smartlist mailing list Smartlist@lists.RWTH-Aachen.DE http://MailMan.RWTH-Aachen.DE/mailman/listinfo/smartlist