[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: procmail rule for html mail



Rob VanFleet <rvf@biglinux.tccw.wku.edu> writes:

> It seems like this has come up before, but I couldn't turn anything up
> from searching.  Basically, I am looking for a procmail rule that will
> detect html mail, and pipe it to a script to strip the tags from it,
> preferably before the other rules are applied, so it still ends up in
> the proper mailbox, but that is not a necessity.

One way to do it:

1) Scan a few of the kind of mails you want to do this to.  Look for a
   `Contents-Type': header.  Here is how one of the might look:
   Content-Type: text/html; charset=us-ascii.  There are others  This
   one has both a text and html version of the message.

Once you have determined what content headers you need to grab:
(Assuming you've already worked out the details of a functioning
.procmailrc) 

   :0 f
   * ^Content-Type: <your types go here in regex format>
   | my_stipper_script

The `f' indicates that you want this to be a filter only.  Not a
delivery recipe.  The message will be filtered thru your script then
sent on to what ever else you want



Reply to: