Issue36093
Created on 2019-02-23 07:59 by Windson Yang, last changed 2022-04-11 14:59 by admin.
| Messages (4) | |||
|---|---|---|---|
| msg336374 - (view) | Author: Windson Yang (Windson Yang) * | Date: 2019-02-23 07:59 | |
AFAIK, the email address should support non-ASCII character (from https://stackoverflow.com/questions/760150/can-an-email-address-contain-international-non-english-characters and SMTPUTF8 option from https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail) >>> import smtplib >>> s = smtplib.SMTP(host='smtp-mail.outlook.com', port=587) >>> s.verify('你好@outlook.com') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/windson/learn/cpython/Lib/smtplib.py", line 577, in verify self.putcmd("vrfy", _addr_only(address)) File "/Users/windson/learn/cpython/Lib/smtplib.py", line 367, in putcmd self.send(str) File "/Users/windson/learn/cpython/Lib/smtplib.py", line 352, in send s = s.encode(self.command_encoding) UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-6: ordinal not in range(128) I found this issue when I updating https://github.com/python/cpython/pull/8938/files |
|||
| msg336375 - (view) | Author: Windson Yang (Windson Yang) * | Date: 2019-02-23 08:04 | |
Btw, from the docs https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail > msg may be a string containing characters in the ASCII range, or a byte string. A string is encoded to bytes using the ascii codec, and lone \r and \n characters are converted to \r\n characters. A byte string is not modified. So we can't send non-ASCII msg using send_mail(), is this expected behavior? |
|||
| msg336509 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-02-25 10:14 | |
Barry: would you mind to have a look at this issue? It seems like smtplib encodes Unicode commands to ASCII, whereas verify() argument (SMTP "VRFY" command) is an hostname and hostname can be non-ASCII ("punycode" encoding, RFC 3492).
|
|||
| msg365140 - (view) | Author: Windson Yang (Windson Yang) * | Date: 2020-03-27 09:07 | |
Any update? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:11 | admin | set | github: 80274 |
| 2020-03-27 11:16:23 | vstinner | set | nosy:
- vstinner |
| 2020-03-27 09:07:12 | Windson Yang | set | messages: + msg365140 |
| 2019-02-25 10:14:54 | vstinner | set | nosy:
+ barry messages: + msg336509 |
| 2019-02-23 08:04:47 | Windson Yang | set | messages: + msg336375 |
| 2019-02-23 07:59:18 | Windson Yang | create | |
