`
seagle0128
  • 浏览: 43588 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论
收藏列表
标题 标签 来源
用python发送html格式的邮件 python 如何用python发送html格式的邮件
import smtplib
from email.MIMEText import MIMEText

smtp_server = smtplib.SMTP(smtp_host)

html='<html><body>hello world</body></html>'
msg = MIMEText(html, 'html')
msg['From'] = sender
msg['To'] = recipient
msg['Subject'] = 'hello'

smtp_server.set_debuglevel(1) #output debug log

smtp_server.sendmail(sender, recipient, msg.as_string())

Global site tag (gtag.js) - Google Analytics