|
@@ -34,25 +34,24 @@ def send_email(report_name):
|
|
|
username="liumm_6064@163.com"
|
|
|
password="TPVBPYSETVHWTIDH"
|
|
|
#接受邮件的邮箱
|
|
|
- receiver=['lizhikun@topnet.net.cn']
|
|
|
+ receiver=['yanpeizhu@topnet.net.cn','renzheng@topnet.net.cn','lianbingjie@topnet.net.cn','lizhikun@topnet.net.cn','jialuyao@topnet.net.cn','liumiaomiao@topnet.net.cn','luwenna@topnet.net.cn','zangyamei@topnet.net.cn','yuanyuan@topnet.net.cn']
|
|
|
#创建邮件对象
|
|
|
message=MIMEMultipart('related')
|
|
|
#邮件主题
|
|
|
subject="剑鱼自动化测试报告"
|
|
|
- fujian=MIMEText(open(f'D:\PycharmProjects\jianyu_auto_api\log/{report_name}','rb').read(),'html','utf-8')
|
|
|
+ fujian=MIMEText(open(f'/mnt/jianyu_auto_api/log/{report_name}','rb').read(),'html','utf-8')
|
|
|
#把邮件信息组装到邮件对象里面
|
|
|
message['from']=username
|
|
|
message['to']= ",".join(receiver)
|
|
|
message['subject']=subject
|
|
|
message.attach(fujian)
|
|
|
#登录smtp服务器并发送邮件
|
|
|
- smtp=smtplib.SMTP()
|
|
|
- smtp.connect(smtpserver)
|
|
|
+ smtp=smtplib.SMTP_SSL(smtpserver,465)
|
|
|
smtp.login(username,password)
|
|
|
smtp.sendmail(username,receiver,message.as_string())
|
|
|
smtp.quit()
|
|
|
if __name__ == '__main__':
|
|
|
- dir = r'D:\PycharmProjects\jianyu_auto_api\log'
|
|
|
+ dir = r'/mnt/jianyu_auto_api/log'
|
|
|
filename = find_newest_file(dir)
|
|
|
if filename:
|
|
|
send_email(filename)
|