发送自动化测试报告到自己的邮箱

# 发送到邮箱

#邮箱服务器
smtpserver = 'smtp.163.com'
#发送邮箱
sender = '[email protected]'
#发送邮箱的账号密码
username = '[email protected]'
password = 'password'
#发送邮件主题
subject = '自动化测试报告'
#接收邮箱
receiver = '[email protected]'
#文件内容
msg = MIMEText( HtmlFile,'html','utf-8')
msg['Subject'] = Header(subject,'utf-8')

msg['from'] = '[email protected]'
msg['to'] = '[email protected]'

smtp = smtplib.SMTP()
smtp.connect(smtpserver)
smtp.login('[email protected]','password')
a1=smtp.sendmail(sender,receiver,msg.as_string())
smtp.quit()
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章