procmail
[Top] [All Lists]

Netscape Html filter

1998-01-07 14:55:23
On Tue, 6 Jan 1998 23:12:24 -0500, Ray Curtis <ray(_at_)clark(_dot_)net> wrote:
I am fairly new to writing any filters for procmail, therefore I am
coming to you guys for some help. Seems like several of the lists
I am on have a few people that contineously send their mail with
html attachments. Is there a method to just cut this portion out
of the message that seems to start like:

------=_NextPart_000_0083_01BD1AC9.A48FFB50
Content-Type: text/html;
     charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


This is a standard problem. You can have an easy but not foolproof
answer, or a complicated answer. 

1. Simple and stupid
   Write a sed, awk, or Perl script to do what you +think+ is required
   to ditch a single MIME body part from a MIME message

   :0fb
   * ^Content-Type: text/html
   | your-script-here

2. Reliable but somewhat heavy
   Get a real MIME decoder and let it do the work for you. See the
   comp.mail.mime FAQ for pointers (you want part 6, if memory
   serves) 

MIME isn't a terribly complicated format but you will shoot yourself
in the foot sooner or later if you try a simplistic sed script, and
it's already been done for you in Perl. From a mail processing
standpoint, a compiled MIME decoder written in C is probably going to
be a lot more efficient than any Perl solution, so you might want to
look at munpack and friends instead of the Perl implementations.

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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