in reply to Finding e-mail headers

Have you looked at Mail::Header?

An email is composed of the headers, one blank line and the body. A regex could even be used if you really wanted to. Untested: my ($header, $body) = $email =~ /^(.*?\n)\n(.*)$/;

Replies are listed 'Best First'.
Re: Re: Finding e-mail headers
by Callum (Chaplain) on Jun 30, 2003 at 18:24 UTC
    In addition to Mail::header (which is almost certainly the best starting place) you may wish to also look at Mail::Field both of which are part of MailTools.
      I'll give that a shot and have a look - since that was the module that I was trying to use initially and which fails on these files, I figured perhaps it wasn't the best place to take code from in this case.

      but that is an excellent point, and perhaps it is something as minor as instead of \n\n, it is throwing a \r in there as well since IIRC Windows enjoys those.

      -------------------------------------------------------------------
      There are some odd things afoot now, in the Villa Straylight.
Re: Re: Finding e-mail headers
by AssFace (Pilgrim) on Jun 30, 2003 at 18:50 UTC
    Yeah, I ran MailTools on it the first shot thinking that would be far easier and that was what started this and the previous post that I made.

    I just tried out that code (yours their) on the file and that too failed. Which, if that is how MailTools does it, is likely why it didn't work I guess.

    I thought I had seen that Windows adds a "\r" when it puts down "\n"s, so I tried all the combinations of that being in there with the "\n" and those too all failed to show headers (or the body with that code).



    -------------------------------------------------------------------
    There are some odd things afoot now, in the Villa Straylight.