etiquette & html -- and procmail (was Re: A problem.)

Bob George plug-discuss@lists.plug.phoenix.az.us
Mon, 21 Oct 2002 13:28:36 -0700


Thomas "Mondoshawan" Tate wrote:
 > [...] Perhaps, then, we should put an HTML filter at the recieving
 > end of the list? Some users are still using hotmail accounts which
 > _only_ send in HTML now.

I've always wondered why such processing isn't more standard on the
server-side for lists. Mind you, I don't RUN an active list either, but 
it seems to me that cleanup makes the most sense there.

I have at various times been annoyed by HTML, return-receipt-requests, 
web beacons and other nonsense in mails from various lists and while I 
realize it's not a fix for the underlying problem, I have come up with 
some procmail rules that work well for me. No doubt these can be improved.

from ~/.procmailrc:

--- cut here --- cut here ---

# Strip Content-Length: header to avoid client problems
:0 fw
* ^Content-Length:
| formail -I "Content-Length:"

#------------------------------------------------------
# Strip return receipt requests
#------------------------------------------------------
:0 fw
* ^Return-Receipt-To: .*
| formail -I "Return-Receipt-To:" -A "X-ProcmailRule: Stripped 
Return-Receipt-To:"

:0 fw
* ^Disposition-Notification-To: .*
| formail -I "Disposition-Notification-To:" -A "X-ProcmailRule: Stripped 
Disposition-Notification-To:"

# (in practice, I use one or the other of these,
#  depending on whether I'll tolerate HTML or not.)
#------------------------------------------------------
# Strip HTML
#------------------------------------------------------
:0
* ^Content-Type: text\/html.*
{
         :0 bfw
         | /usr/bin/html2text

         :0 fw
         | formail -A"X-ProcmailRule: Stripped Yahoo! HTML"
}

#------------------------------------------------------
# Strip web beacon images and replace with note
#------------------------------------------------------
:0 Bfw
* img .*(WIDTH|width)=1 .*src=\"http://
* img .*(HEIGHT|height)=1 .*src=\"http://
| formail -A"X-ProcmailRule: Generic web beacon removed"|sed s/"<img 
.*width=1 .*src=\".*\">"/"<p><i>Removed generic web beacon<\/i><\/p>"/

--- cut here --- cut here ---

I understand that some MTAs can use procmail in-line on delivery. Could 
this be used to 'sanitize' inbound list mail (presumably with some sort 
of note inserted that obnoxious formatting was removed)?

- Bob