famu xu added the comment:
import smtplib
from email.message import EmailMessage
from email.utils import formataddr
server = smtplib.SMTP('smtp.xxx.com',port=25)
server.login('y...@xxx.com', 'password')
msg = EmailMessage()
#if address username include Chinese or other multibytes language, it will be
encode to utf8 and base64, like '?utf-8?B?6YKu5Lu25rWL6K+V?= ',
but the raw smtp request data error, "From: xxx" and "To: xxx" fields has the
error end char:"\r\r\r\r\n".
#From: ?utf-8?B?6YKu5Lu25rWL6K+V?= \r\r\r\r\n
msg['From'] =formataddr(('中文','y...@xxx.com'))
msg['To'] = formataddr(('中文姓名','t...@yyy.com'))
msg['Subject'] =subject
msg.set_content('something')
server.send_message(msg)
server.quit()
--
___
Python tracker
<https://bugs.python.org/issue37572>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com