in reply to Re^3: parsing and printing e-mail
in thread parsing and printing e-mail

Sure, here is what an e-mail looks like if it contains both text/plain and text/html portions:

This is a multi-part message in MIME format. ------=_NextPart_000_0009_01CA7F30.7F3A37C0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: sender@email.address Sent: Wednesday, December 16, 2009 9:28 PM To: test@email.address Subject: This is the subject This is the body. ------=_NextPart_000_0009_01CA7F30.7F3A37C0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html> <head> <body> This is the body. </body> </html> ------=_NextPart_000_0009_01CA7F30.7F3A37C0--

I am trying to find the best way to retrieve just the HTML portion (intact, with the html tags still there). As you can see, there are all sorts of headers. Anyone know a good module for this?

Replies are listed 'Best First'.
Re^5: parsing and printing e-mail
by afoken (Chancellor) on Dec 21, 2009 at 20:24 UTC

    That's a standard MIME mail, so MIME::Parser (and its helper modules) should work fine for splitting the mail into usable pieces. Fishing out the right ones is your job.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)