首页 > 其他 > 详细

自动发送邮件

时间:2020-08-20 23:23:19      阅读:81      评论:0      收藏:0      [点我收藏+]
import smtplib
from email.mime.text import MIMEText
from email.header import Header

#发送邮件主题
subject = "python email test"

#编写HTML类型的邮件正文
msg = MIMEText("<html><h1>你好!</h1><html>", "html", "utf-8")
msg["Subject"] = Header(subject, "utf-8")

#发送邮件
smtp = smtplib.SMTP()
smtp.connect("smtp.163.com")
#使用SMTP登录时,密码为授权码
smtp.login("¥¥¥¥.com", "授权码")
smtp.sendmail("¥¥¥¥@163.com", "¥¥¥¥¥@163.com",msg.as_string())
smtp.quit()

 技术分享图片

 

自动发送邮件

原文:https://www.cnblogs.com/yijierui/p/13538322.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!