fix: null subject when non-Debug mode

This commit is contained in:
Ting-Jun Wang 2024-03-22 19:58:05 +08:00
parent a9c3e63b44
commit 65beca5067
Signed by: snsd0805
GPG Key ID: 48D331A3D6160354

View File

@ -194,7 +194,7 @@ def mail_notify(violators: list) -> None:
print(f' {username} {usage_msg}')
msg = MAIL_MESSAGE.format(username, usage_msg)
msg = MIMEText(msg, 'html') # 郵件內文
msg['Subject'] = f'[網管通知] 提醒您已經超過 CMLab GPU 使用限制!({username})' + "(DEBUG MODE)" if DEBUG_MODE else ""
msg['Subject'] = f'[網管通知] 提醒您已經超過 CMLab GPU 使用限制!({username})'
msg['From'] = 'unix_manager@cmlab.csie.ntu.edu.tw'
msg['To'] = f'{username}@cmlab.csie.ntu.edu.tw' if not DEBUG_MODE else 'snsd0805@cmlab.csie.ntu.edu.tw'
msg['Cc'] = 'unix_manager@cmlab.csie.ntu.edu.tw' if not DEBUG_MODE else 'snsd0805@cmlab.csie.ntu.edu.tw'