我正在使用下面的APi发送带有附件的邮件
https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=multipart
当收件人姓名为英语时效果很好,但是如果收件人姓名包含多字节(例如日语),我将得到400(错误请求)作为响应。
def create_raw():
message['to'] = ','.join([recipients_dict['name']+
<"+recipients_dict['email_address']+">" for recipients_dict in
recipients['to']])
message['from'] = email_address
message['subject'] = subject
msg = MIMEText(body)
message.attach(msg)
当recipients_dict['name']
为“英语”时,API可以正常工作,但对于多字节字符
获取HTTP 400(错误请求)错误
。