[New-bugs-announce] [issue30428] mailbox.MMDF wrongly adds From_ header to file
Ralph Corderoy
report at bugs.python.org
Mon May 22 06:28:18 EDT 2017
New submission from Ralph Corderoy:
Class mailbox.MMDF supports the MMDF-mail-spool file format. This is a file with zero or more records, each starts and ends with a line of four ASCII SOHs. Within those two lines is an email in RFC 5532 format, i.e. a headers section followed by an optional body. There is no "From_" header before the headers section as used by mbox format.
https://docs.python.org/3/library/mailbox.html#mmdf references http://www.tin.org/bin/man.cgi?section=5&topic=mmdf that explains this clearly and gives an example spool file; there is no "From_" header.
mailbox.MMDF documents it produces a From_ header and does so. This is wrong. It's wrong in Python 2 too.
>>> import mailbox as mb
>>> f = mb.MMDF('mail.spool')
>>> f.add('Subject: Python Bug.\nFrom: bug at hunter.com\n\nEnds.\n')
0
>>> f.close()
>>> print(repr(open('mail.spool').read()))
'\x01\x01\x01\x01\nFrom MAILER-DAEMON Mon May 22 10:14:02 2017\nSubject: Python Bug.\nFrom: bug at hunter.com\n\nEnds.\n\n\x01\x01\x01\x01\n'
>>>
Other MMDF-handling software other than tin(1), e.g. http://www.nongnu.org/nmh/, neither produces a From_ header for MMDF, nor handles one being present.
----------
components: Library (Lib)
messages: 294138
nosy: ralph.corderoy
priority: normal
severity: normal
status: open
title: mailbox.MMDF wrongly adds From_ header to file
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30428>
_______________________________________
More information about the New-bugs-announce
mailing list