我需要发送包含unicode字符的smtp邮件(utf-8)
我收到此错误" ascii编解码器无法解码位置0的字节0x7d:序号不在0-128"
范围内这是我的代码:
for mail in mails:
sender = 'omris@esg.co.il'
receivers = [mail]
message = """From: From server <server@esg.co.il>
To: To client <client@esg.co.il>
Subject: SMTP e-mail test
analysis of %s for company %s just finished
""" % (subject, custName)
try:
smtpObj = smtplib.SMTP('code',port)
smtpObj.sendmail(sender, receivers, message)
#self.SchedulerLogger.info("mail has been sent to analysts")
print "Successfully sent email to: ", mail
except Exception,ex:
print ex.message
print "Error: unable to send email"
except Exception,ex:
self.SchedulerLogger.error(str(ex.message))
self.SchedulerLogger.info("send mail failure")
custName是希伯来文..