Message347826
import smtplib
from email.message import EmailMessage
from email.utils import formataddr
server = smtplib.SMTP('smtp.xxx.com',port=25)
server.login('you@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?= <you@xxx.com>', 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?= <you@xxx.com>\r\r\r\r\n
msg['From'] =formataddr(('中文','you@xxx.com'))
msg['To'] = formataddr(('中文姓名','to@yyy.com'))
msg['Subject'] =subject
msg.set_content('something')
server.send_message(msg)
server.quit() |
|
Date |
User |
Action |
Args |
2019-07-13 14:20:56 | famu xu | set | recipients:
+ famu xu, barry, r.david.murray, mangrisano |
2019-07-13 14:20:56 | famu xu | set | messageid: <1563027656.0.0.057124418286.issue37572@roundup.psfhosted.org> |
2019-07-13 14:20:55 | famu xu | link | issue37572 messages |
2019-07-13 14:20:55 | famu xu | create | |
|