發送自動化測試報告到自己的郵箱

# 發送到郵箱

#郵箱服務器
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()
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章