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 macfreek
Recipients barry, macfreek, r.david.murray
Date 2013-12-28.20:31:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1388262666.71.0.873309539219.issue20084@psf.upfronthosting.co.za>
In-reply-to
Content
Are you sure that issue 8489 is a duplicate? While both concern RFC 6531, the patch for 8489 only seems to add test to check how smtplib.SMTP.login() handles a username with non-ASCII characters. This issue concerns the smtplib.SMTP.rcpt() (and indirectly smtplib.SMTP.send()).

From your comment in issue 20083 you seem to prefer that all input is in strings, not bytes. I think that is sensible, but it means that smtplib is responsible for doing the encoding, including the UTF-8 encoding instead of ASCII encoding for mails that support the SMTPUTF8 extension.

Would the following be reasonable?

* The smtplib.SMTP class gets a new attribute, header_encoding
* The header_encoding attribute is 'ascii' by default.
* header_encoding is used by the send() method, and perhaps also by the login() method, but not by the data() method (for that, a body_encoding sounds more reasonable).
* A user may set header_encoding explicitly

Open questions are:

* Should the library automatically set header_encoding to UTF-8? If so, when? If the connected server announces the SMTPUTF8 extension?
* What should happen if the users submits non-ASCII data in any of the headers, but the server has not announced the SMTPUTF8 extension? Currently, this raises a UnicodeEncodeError exception, but I think it should be more explicit that it is a combination of Unicode input combined with lack of support from the MTA.
History
Date User Action Args
2013-12-28 20:31:06macfreeksetrecipients: + macfreek, barry, r.david.murray
2013-12-28 20:31:06macfreeksetmessageid: <1388262666.71.0.873309539219.issue20084@psf.upfronthosting.co.za>
2013-12-28 20:31:06macfreeklinkissue20084 messages
2013-12-28 20:31:06macfreekcreate