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

Tony Meyer t-meyer at ihug.co.nz
Mon Nov 29 01:07:12 CET 2004


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

>>> import email
>>> email.__version__
'2.5.5'
>>> s = '>From 6r331g9 at bigfoot.com  Fri Jan 23 11:31:44
2004\r\nSubject:test\r\n\r\nTest\r\n'
>>> m = email.message_from_string(s)
>>> m.keys()
['>From 6r331g9 at bigfoot.com  Fri Jan 23 11', 'Subject']
>>> m.as_string()
'>From 6r331g9 at bigfoot.com  Fri Jan 23 11: 31:44 2004\nSubject:
test\n\nTest\r\n'

>>> import email
>>> email.__version__
'3.0b1'
>>> s = '>From 6r331g9 at bigfoot.com  Fri Jan 23 11:31:44
2004\r\nSubject:test\r\n\r\nTest\r\n'
>>> m = email.message_from_string(s)
>>> m.keys()
[]
>>> m.as_string()
'\n>From 6r331g9 at bigfoot.com  Fri Jan 23 11:31:44
2004\r\nSubject:test\r\n\r\nTest\r\n'

Is this deliberate?  I don't know (and haven't checked) whether it's valid
to start a message like this, but one of my POP servers does (it puts a
>From header at the start of any message).  If this is deliberate, I'll just
strip that off before doing message_from_string, but if it's not, then I
guess it needs to be fixed, and I'll open a tracker for it.

Thanks,
Tony Meyer



More information about the Email-SIG mailing list