天天看點

三行代碼實作郵件發送

# coding:utf-8      
import yagmail      
def apitestreport_to_email():      
# 第一行,連結登入郵箱伺服器      
yag = yagmail.SMTP(user="[email protected]", password="123456", host='smtp.exmail.qq.com')      
# 第二行,郵箱正文      
contents = ['測試詳情:','<a href="http://127.0.0.1/apitestreport/>Click me']      
# 第三行,發送郵件      
yag.send('[email protected]', '接口自動化測試報告',contents)      
if __name__=='__main__':      
apitestreport_to_email()