From 3d736a2d9d836d12e7fb1db15bec80cfc4cbc27c Mon Sep 17 00:00:00 2001 From: dbg Date: Thu, 14 Nov 2019 17:53:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/utils/notice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/notice.py b/server/utils/notice.py index 3101f5c..d70af66 100644 --- a/server/utils/notice.py +++ b/server/utils/notice.py @@ -48,7 +48,7 @@ def mail_notice(smtp_config, receivers, content): message = MIMEText(content, _subtype='html', _charset='utf-8') message['From'] = Header('{}<{}>'.format(smtp_config.get('from'), smtp_config.get('username')), 'utf-8') message['To'] = Header(';'.join(receivers), 'utf-8') - message['Subject'] = Header('[GitHub] 监控告警', 'utf-8') + message['Subject'] = Header('[GitHub] 监控告警 for FR', 'utf-8') try: smtp = SMTPServer(smtp_config) print('login') From 7f3d39e4acc966d669d8339e3b40bc4ee113311c Mon Sep 17 00:00:00 2001 From: dbg Date: Thu, 14 Nov 2019 17:56:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=91=8A=E8=AD=A6title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.MD b/README.MD index c3810e7..41386ab 100644 --- a/README.MD +++ b/README.MD @@ -13,7 +13,20 @@ ## 截图 ![Hawkeye](https://user-images.githubusercontent.com/12611275/46849889-0d2d0980-ce24-11e8-832e-35f6f935bf3b.png) + + + +## dbg 更新 + +- 2019/11/14 + - 更新邮件发送title + + + + + ## **最近更新** + - 2019-07-02 v3.0.1 - 添加健康检查接口 /api/health - 添加企业微信告警 From 8562f3c3d10ca279168752e8884046647c8f1694 Mon Sep 17 00:00:00 2001 From: dbg Date: Wed, 27 Nov 2019 16:49:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/utils/notice.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/utils/notice.py b/server/utils/notice.py index d70af66..cf12cf2 100644 --- a/server/utils/notice.py +++ b/server/utils/notice.py @@ -1,6 +1,7 @@ import smtplib from email.header import Header from email.mime.text import MIMEText +import time class SMTPServer(object): @@ -11,10 +12,10 @@ def __init__(self, smtp_config): self.username = smtp_config.get('username') self.password = smtp_config.get('password') try: - if self.tls: - self.smtp = smtplib.SMTP(self.host, self.port, timeout=300) - else: + if self.tls: self.smtp = smtplib.SMTP_SSL(self.host, self.port, timeout=300) + else: + self.smtp = smtplib.SMTP(self.host, self.port, timeout=300) except Exception as error: print(error) @@ -48,7 +49,7 @@ def mail_notice(smtp_config, receivers, content): message = MIMEText(content, _subtype='html', _charset='utf-8') message['From'] = Header('{}<{}>'.format(smtp_config.get('from'), smtp_config.get('username')), 'utf-8') message['To'] = Header(';'.join(receivers), 'utf-8') - message['Subject'] = Header('[GitHub] 监控告警 for FR', 'utf-8') + message['Subject'] = Header('[GitHub] 监控告警--'+time.asctime(), 'utf-8') try: smtp = SMTPServer(smtp_config) print('login')