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 <>
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.
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: <>
2016-12-06 15:59:15r.david.murraylinkissue28879 messages
2016-12-06 15:59:15r.david.murraycreate