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.20:05:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481918753.15.0.529319686228.issue28879@psf.upfronthosting.co.za>
In-reply-to
Content
Hi all, I was looking at the code of the function and also noticed multiple "itching".

1- Why raise an error when 2 resent-date exist?  it may exist and completely legitimate as per RFC5322.  The code should always take the first one it sees as per the RFC.
2- Also, there was an "ehlo_or_helo_if_needed", but it's done in sendmail function so makes it always irrelevant.
3- The signature of the function is different from the one of sendmail function.  My understanding is that send_message is a replacement of sendmail with more feature (praticality) and should be simple to change by just swaping the 2 of them. 
4- This "send_message" shouldn't be dependant on the email.message.Message class.  It should allow a dictionary to be passed as well.  So I removed the "get_all" to be replaced with a "get" method (which align with what dictionaries do. 


I have addressed 1,2 and 4 in my patch (modified the test case as well) and my efforts to make this better and clearer, but number 3 seems to be something that may be a big change for clients... Should we handle it at all?

Please review and give me feedbacks please, I'm open to negative ones as well ;).  I need to know if I'm doing something wrong and I don't know all the principle (as you may have noticed).  

I've ran the "python -m test" & "./python -m smtplib" command, but is there something else I should've done?

List of things to do :
- Implement a patch for the code to add a missing "Date" field if it doesn't exist .   (in review)
- 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).  ( in review)
- Modify the example of Python 2 to present a RFC 5322 examples

Thanks Henning von Bargen, David, maciej.  I appreciate your support.  

Regards,
Eric Lafontaine
History
Date User Action Args
2016-12-16 20:05:53Eric Lafontainesetrecipients: + Eric Lafontaine, r.david.murray, maciej.szulik, Henning.von.Bargen
2016-12-16 20:05:53Eric Lafontainesetmessageid: <1481918753.15.0.529319686228.issue28879@psf.upfronthosting.co.za>
2016-12-16 20:05:53Eric Lafontainelinkissue28879 messages
2016-12-16 20:05:52Eric Lafontainecreate