Commit 1533a25a authored by 王志伟's avatar 王志伟

send_email

parent ebd1d550
......@@ -306,7 +306,7 @@ ctcvr_tst_new=data_cal(ctcvr_new,ctcvr_new2)
chi_cal(ctcvr_tst_new)
# ###############数据波动大小检验##############
print("============================分割线,开始检测各个指标的5日内的方差和均值===================================")
print("======分割线,开始检测各个指标的5日内的方差和均值======")
def get_var_data1(x,y,z,t1):
sql_cid = "select {0}/{1} from {2} \
......
##发送邮件
#coding=utf-8
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from email.mime.application import MIMEApplication
import datetime
my_sender='gaoyazhe@igengmei.com'
my_pass = 'VCrKTui99a7ALhiK'
my_user1='wangzhiwei@igengmei.com'
def mail():
ret = True
pdfFile = './test.txt'
pdfApart = MIMEApplication(open(pdfFile, 'rb').read())
pdfApart.add_header('Content-Disposition', 'attachment', filename=pdfFile)
try:
text = "Hi!\nHow are you?\nHere is the link you wanted:\nhttp://www.baidu.com"
msg = MIMEText(text, 'plain', 'utf-8')
msg['From'] = formataddr(["王志伟", my_sender])
msg['To'] = my_user1
msg['Subject'] = str(datetime.date.today()) + "-esmm多目标模型训练指标统计"
server = smtplib.SMTP_SSL("smtp.exmail.qq.com", 465)
server.login(my_sender, my_pass)
server.sendmail(my_sender, [my_user1], msg.as_string())
server.quit()
except Exception:
ret=False
return ret
ret=mail()
if ret:
print("邮件发送成功")
else:
print("邮件发送失败")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment