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.

Author r.david.murray
Recipients Henning.von.Bargen, r.david.murray
Date 2016-12-06.15:59:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481039955.43.0.860526970688.issue28879@psf.upfronthosting.co.za>
In-reply-to
Content
As I implied but did not say explicitly, this is the expected behavior of smtplib.  You are responsible for adding any headers to the message that you want smtplib to send.  In particular, the 'sendmail' method takes a string to send, and smtplib does not modify it except for cr/lf transformation.  smtplib does not itself understand RFC5322 message syntax.

We can, however, add a Date header in the new send_message method of the python3 email library, because it accepts a Message object, and smtplib can use the knowledge the Message object encapsulates to check for the Date header and add one if it is missing.  That's why I've left this issue open.  I have now adjusted versions accordingly (ie: this is not a bug in python2.7, it is an enhancement request for Python3).  Sorry I wasn't clear about this earlier.

Hmm.  Actually, we can argue that it is an RFC compliance issue, as you have suggested, and change it in 3.6 as well, since it isn't likely to break anyone's working code.  So I'll put 3.6 in the versions unless someone objects to that logic.  But even after this is changed in python3, the smtplib sendmail method will not add a Date header, only the send_message method.
History
Date User Action Args
2016-12-06 15:59:15r.david.murraysetrecipients: + r.david.murray, Henning.von.Bargen
2016-12-06 15:59:15r.david.murraysetmessageid: <1481039955.43.0.860526970688.issue28879@psf.upfronthosting.co.za>
2016-12-06 15:59:15r.david.murraylinkissue28879 messages
2016-12-06 15:59:15r.david.murraycreate