This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: email MIME-Version headers for each part in multipart message
Type: behavior Stage: needs patch
Components: email Versions: Python 3.3
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, david.caro, eriker, r.david.murray
Priority: normal Keywords:

Created on 2011-01-26 23:47 by david.caro, last changed 2022-04-11 14:57 by admin.

Messages (6)
msg127161 - (view) Author: David Caro (david.caro) Date: 2011-01-26 23:47
When attaching a subpart to a multipart message, python should follow the recomendations of the rfcs and remove the MIME-Version header of each part, leaving only one MIME-Version header at the beggining of the message.


>>> from email.mime.multipart import MIMEMultipart
>>> from email.mime.text import MIMEText
>>> usermail=MIMEMultipart('alternative')
>>> part=MIMEText('text')
>>> print part
From nobody Thu Jan 27 00:33:50 2011
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

text
>>> usermail.attach(part)
>>> print usermail
From nobody Thu Jan 27 00:45:26 2011
Content-Type: multipart/alternative; boundary="===============1006894803=="
MIME-Version: 1.0

--===============1006894803==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

text
--===============1006894803==--
msg127163 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-01-26 23:53
For the record, can you point to the relevant part of the relevant RFC?
msg130787 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-03-14 03:53
Assuming this is correct (I haven't tried looking for the reference yet), I'm leaning toward it being enough of a behavior change that it should not be backported.
msg130884 - (view) Author: David Caro (david.caro) Date: 2011-03-14 20:01
Of course, the RFC that discusses the MIME-Version Header is  RFC-2045
http://www.ietf.org/rfc/rfc2045.txt

Extract of the page 8:
   "Note that the MIME-Version header field is required at the top level
   of a message.  It is not required for each body part of a multipart
   entity."

Strictly all the implementations should support the MIME-Version on each field, because the RFC does not explicitly say that it should not be included, but all the best practice documents that mention it say that it should not be included in all the parts, my main concern is that maybe it raises the spam level of the sent e-mails.

Maybe it's not critical enough to be backported, but at least, it should be changed for future versions.

Thanks
msg130903 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-03-14 21:22
Yes, if it is not actually an RFC non-compliance I'd rather not backport it, but I'm not averse to changing it.  I'm open to argument about backporting though...if you know of spam filters that actually do count it, let me know.
msg384937 - (view) Author: robin (eriker) * Date: 2021-01-12 13:39
Propose to close as duplicate of https://bugs.python.org/issue25235
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55230
2021-01-12 13:39:17erikersetnosy: + eriker
messages: + msg384937
2012-05-24 03:03:53r.david.murraysetassignee: r.david.murray ->

components: + email, - Library (Lib)
nosy: + barry
2011-03-14 21:22:51r.david.murraysetmessages: + msg130903
2011-03-14 20:01:51david.carosetmessages: + msg130884
2011-03-14 03:53:04r.david.murraysetmessages: + msg130787
versions: + Python 3.3, - Python 3.1, Python 2.7, Python 3.2
2011-01-26 23:53:13r.david.murraysetversions: + Python 3.1, Python 3.2, - Python 2.6
nosy: + r.david.murray

messages: + msg127163

assignee: r.david.murray
stage: needs patch
2011-01-26 23:47:24david.carocreate