python自动化中send_email方法封装
#coding:utf-8 import yagmail class SendEmail(): '''发送自动化测试报告''' def send_mail(self,new_report): sender = "1111@qq.com" #账号 pwd = "111" #密码 host = "smtp.qq.com" #连接服务器 recevers = ["111"] #收件人地址 subject = "自动化测试报告--下载后查看" #邮件主题 contents = "测试通过" #邮件内容 smtp = yagmail.SMTP( user=sender, password=pwd, host=host ) smtp.send( to=recevers, subject=subject, contents=contents, attachments=new_report ) print("emial has send out")