in reply to How can I delete the MIME Headers
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".
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.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.
|
|---|