How many times did you send this message to the list?

* "Basil A. Daoust" <[EMAIL PROTECTED]> [2008-06-24T14:59:34]
> I want to be able to read a MIME encoded email file (Thunderbird) and have 
> a way of returning just the VIEWABLE body part.

"Viewable" isn't defined by any RFC.  What do you mean?

> I tried Email::Simple but I get all the MIME encoding and both the TEXT and 
> the HTML parts.

That won't work, because Email::Simple doesn't understand MIME.

> I tried Mail::Internet but then besides everything that Email::Simple gives 
> I also get all the header data as part of the body.

That won't work, because Mail::Internet doesn't understand MIME.

>   my $obj = Mail::Internet->new([ /\n/, $message ] );    my $body = 
> $obj->body;
>   print @$body,"\n";
>   That returned the entire email, headers and everything, so much for 
> getting the body.

I think you meant to put a "split" after the [.  That's why it put everything
in the body.

You want something like:

  my $root = Email::MIME->new($message_text);
  my ($html_part) = grep { $_->content_type =~ m{^text/html} } $root->subparts;

  my $encoded_html = $html_part->body;
  my $html = Encode::decode($charset_from_content_type, $encoded_html);

-- 
rjbs

Reply via email to