Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: parsing and printing e-mail

by gmargo (Hermit)
on Dec 17, 2009 at 23:05 UTC ( [id://813287]=note: print w/replies, xml ) Need Help??


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

Could you post an example of the "ugly headers"? That may provide a clue. I suspect a Content-Type problem.

Replies are listed 'Best First'.
Re^4: parsing and printing e-mail
by keiusui (Monk) on Dec 21, 2009 at 05:36 UTC
    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?

      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". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://813287]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found