[Email-SIG] Messages that start with '>'

Tony Meyer t-meyer at ihug.co.nz
Mon Nov 29 03:10:26 CET 2004


[Tony Meyer]
>> A change in email 3.0 is that messages that start with '>' are 
>> considered to be all body and no header, e.g:

[Barry Warsaw]
> It's not valid to start a message with ">From".

Are you sure?  I'm not as familiar with RFC2822 as I'm sure you are, but
reading it, it seems that a header name can be any characters from (ASCII
ord) 33-57 and 59-126, which includes ">" (e.g. you could have a ">Dumbname:
value" header).  Non-standard headers typically start with "X-", of course,
but that's not required by RFC2822 (again, as I understand it).

It isn't (AFICT) valid to have a space in the name, so having the
"Unix-From" line is invalid (so I'll work around this stupid POP3 server I
connect to), but without the space, the header name is valid, I think, so it
should work.

New example (email 3.0b1 only):

>>> s = ">Message:bad, bad, bad!\n\nTest"
>>> m = email.message_from_string(s)
>>> m.keys()
[]
>>> m.as_string()
'\n>Message:bad, bad, bad!\n\nTest'
>>> s = "Message:bad, bad, bad!\n\nTest"
>>> m = email.message_from_string(s)
>>> m.keys()
['Message']
>>> m.as_string()
'Message: bad, bad, bad!\n\nTest'

> If you look closely enough at the email 2.5 example, the 
> parser thought the >From line was a normal RFC 2822 header, 
> and split it at the first colon -- inside the time string!  
> So that's clearly broken.
> 
> I think email 3.0 is doing the right thing.

I'm fine with the 'invalid header means all headers in body' rule, but I'm
not convinced that having '>' in the header name makes the header invalid.

Cheers,
Tony



More information about the Email-SIG mailing list