Heikki Hannikainen wrote:

> > Yup it'll ignore anything past the first newline.  A subject is only suppose
> > to be one line isn't it?
>
>   Nope, see RFC822 "STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT
> MESSAGES", part 3.1.1 "LONG HEADER FIELDS". Headers are single-line (a
> newline is not significant in the content), but they may be folded on
> multiple lines if the line length exceeds some sane value (usually 70-80
> characters). So a looong subject line might be represented in the headers
> on multiple lines (as the Received headers often are, for example), you're
> supposed to unfold them (remove the \n\s+). It is a very good idea to read
> through RFC822 if you're writing a parser for it, it's not that long after
> all.
>
>   I once wrote something like this:
>
> while ($line = <>) {
>         chomp $line;
>
>         if ($line eq "") {
>                 last;
>         }
>
>         if ($line =~ /^\s.+$/) {
>                 @hdrs[$#hdrs] .= $line;
>         } else {
>                 push @hdrs, $line;
>         }
> }
>

Okay, thanks, that helps.

Bob

Reply via email to