procmail
[Top] [All Lists]

Re: HTML to text

2003-01-23 11:53:44
On Thursday, Jan 23, 2003, at 06:55 Canada/Mountain, C J Kenneth Tan wrote:
I want to be able to take a mail with HTML as either the only part or
HTML as one of the multiparts, replace the HTML part with a text
version.  Can anyone please help?

well, you could simply strip the text/html portion of the email:

:0f
* ^Content-Type:(.*\<)boundary="\/.*"
{
  BOUNDS="$MATCH"
  LOG="$BOUNDS$NL"
  :0
  | formail -i "Content-Type: text/plain" \
            -i "X-Boundary: $MATCH"

  :0
  | sed -e '/--$\BOUNDS(.*)\<Content-Type: text\/html/,/--$\BOUNDS/d'
}

that might work for a start with multi part html that has boundaries. For the html that has no plain text portion you'll have to strip the html tags. That's pretty easy...



--
It was intended that when Newspeak had been adopted once and for all and Oldspeak forgotten, a heretical thought...should be literally unthinkable, at least so far as thought is dependent on words.


_______________________________________________
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>