http://www.perlmonks.org?node_id=847058


in reply to Trying to correctly parse MIME

Hi Interwebs

I have downloaded your files and had a play. First of all your script is not terribly informative. I was debugging at around line 16 and I think at this stage you find it helpful to add this there:

die "empty header" if !$header; print $header->as_string;
This shows that if you remove the initial empty line at the start of the email file it at least it picks up the headers. Did you try debugging the code and using the various as_string methods in MIME::Tools to get more insight into what is happening?