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 Eric Lafontaine
Recipients Eric Lafontaine, Henning.von.Bargen, maciej.szulik, r.david.murray
Date 2016-12-16.02:12:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481854366.24.0.0548341121635.issue28879@psf.upfronthosting.co.za>
In-reply-to
Content
Hi all,

Thanks for the enlightment.  I never figured that there was a send_message function XD.  Never needed it and it's true that the example in the email library use sendmail and not send_message.
https://docs.python.org/2/library/smtplib.html#smtplib.SMTP.sendmail
https://docs.python.org/3.5/library/smtplib.html#smtplib.SMTP.send_message

This function is fairly recent (python 3.2) from what I see.

Reading the documentation of the python 3.5 send_message function :
"[...] If from_addr is None or to_addrs is None, send_message fills those arguments with addresses extracted from the headers of msg as specified in RFC 5322: from_addr is set to the Sender field if it is present, and otherwise to the From field. to_addrs combines the values (if any) of the To, Cc, and Bcc fields from msg. "

As we're already using this function for convenience of the RFC 5322, then I agree to add it.  We should also modify the doc & comment inside the code to make it clear that date is added if absent and following RFC 5322. (I've looked at the source and the send_message only mention RFC2822 in the comments, no RFC 5322).

Finally, why would we want to add a validate fonction to the email library?  What would it do ? validate that we respect a certain RFC?  Who other than SMTPlib would use it?  I would like to understand the reasonning behind it.  

Again, all this are opinions to let the discussion continue :).

For now, what I see we need to do (this bullet point list is intended to be expanded with what you think we need to do):
- implement a patch for the code to add a missing "Date" field if it doesn't exist
- Modify the documentation at the SMTPLib for the send_message to mention that it add missing date using the email.utils.formatdate
- Modify the comment of the send_message code to mention RFC 5322 in there (ideally with the section of the RFC).
- Fix it on all Python3 versions?  It should have been supported since 3.2 right?

As it's my first time trying to contribute... I still don't know how to do so...

Regards,
Eric Lafontaine
eric.lafontaine1@gmail.com <= if you can help me outside of this discussion to contribute, it would be my pleasure.
History
Date User Action Args
2016-12-16 02:12:46Eric Lafontainesetrecipients: + Eric Lafontaine, r.david.murray, maciej.szulik, Henning.von.Bargen
2016-12-16 02:12:46Eric Lafontainesetmessageid: <1481854366.24.0.0548341121635.issue28879@psf.upfronthosting.co.za>
2016-12-16 02:12:46Eric Lafontainelinkissue28879 messages
2016-12-16 02:12:44Eric Lafontainecreate