I'm not 100% sure what your eventual goal is, so I'll speak in general terms.
Most HTML mail is made up of one or more MIME attachments. The MIME::Tools suite that an earlier poster mentioned will let you take those apart and look at the pieces.
MIME messages contain entities, each of which in turn can contain their own entities. A single entity is something like text, or a picture, or a binary attachment of some sort. Usually, the HTML attachment is a single entity.
Having used MIME::Tools to break your message down into a collection of entities, you can use the HTML modules another poster mentioned to construct just the formatted text from an HTML entity.
At that point, it gets a little tricky. What will you do with this formatted text? Replace the HTML entity with an entity of type text/plain? Turn the root entity into a multipart/alternative message and attach your new text/plain entity as an alternate? What if there already was an alternate? What if there's more than one HTML entity? What if this wasn't a MIME message, but just a plain old mail message which
happened to contain HTML?
(Or maybe you just want to do some processing on the text and leave the mail unchanged, I don't know.)
All kinds of things are possible, but you need to ramp up a little on MIME messages (and how Outlook will process them) before you can really make an informed decision. O'Reilly's
Programming Internet Email is a great resource for this.
Peace,
-McD
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.