Parse text/html part of email source using Javascript

Posted by Ben McCormack on Stack Overflow See other posts from Stack Overflow or by Ben McCormack
Published on 2012-07-03T20:25:04Z Indexed on 2012/07/03 21:15 UTC
Read the original article Hit count: 274

Filed under:
|
|
|

Using javascript, I need to parse the Content-Type text/html portion of an email message and extract just the HTML part. Here's an example of the part of the mail source in question:

------=_Part_1504541_510475628.1327512846983
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit


<html ... a bunch of html ...

/html>

I want to extract everything between (and including) the <html> tags after text/html. How do I do this?

NOTE: I'm OK with a hacky regex. I don't expect this to be bulletproof.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex