jenkins 测试邮件python脚本

import smtplib
from email.mime.text import MIMEText
from email.header import Header

#发送html 格式的邮件

#发送邮件
sender = "[email protected]"
#接受邮箱
receiver = "[email protected]"
#发送邮件主题
subject = "自动化测试"
#发送邮箱服务器
smtpserver = "smtp.qq.com"
#发送邮箱用户名/密码
username="[email protected]"
password = "siygipkprzcebjdb"

#HTML形式的邮件

msg=MIMEText("<html><h1>This Test Report!</h1></html>","html","utf-8")
msg["Subject"]=Header(subject,"utf-8")

smtp=smtplib.SMTP_SSL(smtpserver,465)
smtp.login(username,password)
smtp.sendmail(sender,receiver,msg.as_string())
smtp.quit()

猜你喜欢

转载自blog.csdn.net/weixin_42125267/article/details/81390523
今日推荐