优化错误邮件的标题
This commit is contained in:
@@ -6,6 +6,7 @@ from email.mime.text import MIMEText
|
||||
from tenacity import retry, stop_after_attempt, wait_random
|
||||
|
||||
from auto_email import ERROR_EMAIL_CONFIG, TRY_TIMES, MIN_WAIT_TIME, MAX_WAIT_TIME
|
||||
from log import HOSTNAME
|
||||
|
||||
|
||||
@retry(stop=stop_after_attempt(TRY_TIMES), wait=wait_random(MIN_WAIT_TIME, MAX_WAIT_TIME), reraise=True,
|
||||
@@ -39,7 +40,7 @@ def send_error_email(program_name, error_name, error_detail):
|
||||
# 获取程序出错的时间
|
||||
error_time = datetime.datetime.strftime(datetime.datetime.today(), "%Y-%m-%d %H:%M:%S:%f")
|
||||
# 邮件内容
|
||||
subject = f"【程序异常提醒】{program_name} {error_time}" # 邮件的标题
|
||||
subject = f"【程序异常提醒】{program_name}({HOSTNAME}) {error_time}" # 邮件的标题
|
||||
content = f'''<div class="emailcontent" style="width:100%;max-width:720px;text-align:left;margin:0 auto;padding-top:80px;padding-bottom:20px">
|
||||
<div class="emailtitle">
|
||||
<h1 style="color:#fff;background:#51a0e3;line-height:70px;font-size:24px;font-weight:400;padding-left:40px;margin:0">程序运行异常通知</h1>
|
||||
|
||||
Reference in New Issue
Block a user