in reply to How can I delete the MIME Headers

You will want to use MIME-tools, most likely. This is a heavy-duty module distribution, but it parses all the MIME stuff, with the caveat that it loads attachments into memory, so may die on giant MP3 files if you don't have a whole lot of memory.

The documentation is good, but you have to flip back and forth a bunch to get what you need. Here is a basic usage summary. I assume your mail is saved to a file named "incoming".

use MIME::Parser; my $parser=MIME::Parser->new; $parser->output_dir("/temp"); open FILE "incoming" || die "Couldn't open file\n"; my $entity=$parser->read(\*FILE)|| die "Couldn't parse\n"; my $head=$entity->head; $entity->dump_skeleton; ## Print out the structure.
HTML messages are often sent as multipart/alternative, which means you can look through the parts to find one with Content-Type: text/plain. If there's not one there, you'll have to parse the HTML to get the message. As the other response here mentions, HTML::Parser will help you there.