liumiaomiao 5 сар өмнө
parent
commit
0469a48280

+ 4 - 5
doc/sendemail.py

@@ -34,25 +34,24 @@ def send_email(report_name):
     username="liumm_6064@163.com"
     username="liumm_6064@163.com"
     password="TPVBPYSETVHWTIDH"
     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')
     message=MIMEMultipart('related')
     #邮件主题
     #邮件主题
     subject="剑鱼自动化测试报告"
     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['from']=username
     message['to']= ",".join(receiver)
     message['to']= ",".join(receiver)
     message['subject']=subject
     message['subject']=subject
     message.attach(fujian)
     message.attach(fujian)
     #登录smtp服务器并发送邮件
     #登录smtp服务器并发送邮件
-    smtp=smtplib.SMTP()
-    smtp.connect(smtpserver)
+    smtp=smtplib.SMTP_SSL(smtpserver,465)
     smtp.login(username,password)
     smtp.login(username,password)
     smtp.sendmail(username,receiver,message.as_string())
     smtp.sendmail(username,receiver,message.as_string())
     smtp.quit()
     smtp.quit()
 if __name__ == '__main__':
 if __name__ == '__main__':
-    dir = r'D:\PycharmProjects\jianyu_auto_api\log'
+    dir = r'/mnt/jianyu_auto_api/log'
     filename = find_newest_file(dir)
     filename = find_newest_file(dir)
     if filename:
     if filename:
         send_email(filename)
         send_email(filename)