Python发送邮件,body是html(纯文本)的,收到后怎么变成了源码格式了?

file = "AbstractCachingViewResolver.html"
content = open(file).read()
body = content
send_mail(mail, subject, body)
应该怎么解决?

from email.mime.text import MIMEText
...
body = MIMEText(content,_subtype='html',_charset='utf8')
...
send_mail(mail, subject, body.as_string())

温馨提示:答案为网友推荐,仅供参考
相似回答