Commit 03a926fd authored by litaolemo's avatar litaolemo

update

parent ffd0efe4
......@@ -8,6 +8,7 @@ from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from email.utils import formataddr
from maintenance.func_send_email_with_file import send_file_email
es = Elasticsearch([
{
......@@ -23,7 +24,7 @@ def send_email_tome():
try:
date = datetime.datetime.now().date() - datetime.timedelta(days=1)
fromaddr = 'litao@igengmei.com'
password = 'hTx9kAikArsSNsDr'
# password = 'Lemo1995'
# toaddrs = "lixiaofang@igengmei.com"
# toaddrs1 = "duanyingrong@igengmei.com"
# toaddrs2 = "dengguangyu@igengmei.com"
......@@ -34,40 +35,12 @@ def send_email_tome():
content = 'hi all:附件为' + str(date) + '的搜索词数据统计结果以及近一周的数据统计结果,请查收!'
textApart = MIMEText(content)
zipFile = str(date)+".xls"
#zipFile = '昨日数据统计结果.xls'
zipApart = MIMEApplication(open(zipFile, 'rb').read())
zipApart.add_header('Content-Disposition', 'attachment', filename=zipFile)
zipFile_week = '近一周数据统计结果.xls'
zipApart_week = MIMEApplication(open(zipFile_week, 'rb').read())
zipApart_week.add_header('Content-Disposition', 'attachment', filename=zipFile_week)
m = MIMEMultipart()
m.attach(textApart)
m.attach(zipApart_week)
m.attach(zipApart)
m['From'] = formataddr(["黎涛", toaddrs6])
# m["To"] = formataddr(["李小芳", toaddrs])
# m["To"] = formataddr(["段英荣", toaddrs1])
# m["To"] = formataddr(["邓光宇", toaddrs2])
# m["To"] = formataddr(["王昕", toaddrs3])
# m["To"] = formataddr(["赫梓君", toaddrs4])
m["To"] = formataddr(["黎涛", toaddrs6])
m['Subject'] = '每日搜索词结果统计'
try:
server = smtplib.SMTP_SSL('smtp.exmail.qq.com', 465)
server.login(fromaddr, password)
server.sendmail(fromaddr, [toaddrs6], m.as_string())
print('success')
server.quit()
except smtplib.SMTPException as e:
print('error', e)
except Exception:
logging.error("catch exception,main:%s" % traceback.format_exc())
send_file_email(zipFile,email_group=["litao@igengmei.com"],title_str=content
,data_str=content)
except Exception as e:
print(e)
def get_es_word(word):
......
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