Message207052
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. |
|
Date |
User |
Action |
Args |
2013-12-28 20:31:06 | macfreek | set | recipients:
+ macfreek, barry, r.david.murray |
2013-12-28 20:31:06 | macfreek | set | messageid: <1388262666.71.0.873309539219.issue20084@psf.upfronthosting.co.za> |
2013-12-28 20:31:06 | macfreek | link | issue20084 messages |
2013-12-28 20:31:06 | macfreek | create | |
|