fix: 添加邮件请求日志,便于排查发送问题

This commit is contained in:
2026-06-01 17:44:39 +08:00
parent 23810cf180
commit 89b5a69325
9 changed files with 68 additions and 30332 deletions

Binary file not shown.

View File

@@ -1,9 +1,10 @@
{ {
"thresholds": { "thresholds": {
"cpu": 75, "cpu": 75,
"memory": 80,
"disk": 85, "disk": 85,
"interval": 60 "interval": 60,
"memory": 80,
"cpu_temp": 70
}, },
"web_settings": { "web_settings": {
"external_ip": "121.40.164.32", "external_ip": "121.40.164.32",

30388
logs/app.log

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,9 @@ def register_email_routes(app):
def api_email_send(): def api_email_send():
"""发送邮件通知""" """发送邮件通知"""
data = request.get_json() data = request.get_json()
log_message(f"📨 收到邮件请求: {data}")
if not data: if not data:
log_message(f"❌ 无效数据: content-type={request.content_type}")
return jsonify({'error': '无效数据'}), 400 return jsonify({'error': '无效数据'}), 400
to_email = data.get('to') to_email = data.get('to')
@@ -26,6 +28,7 @@ def register_email_routes(app):
body = data.get('body') body = data.get('body')
if not to_email or not subject or not body: if not to_email or not subject or not body:
log_message(f"❌ 缺少参数: to={to_email}, subject={subject}, body_len={len(body) if body else 0}")
return jsonify({'error': '缺少必要参数'}), 400 return jsonify({'error': '缺少必要参数'}), 400
try: try:

View File

@@ -23,6 +23,10 @@ def get_html_template():
template_content = template_content.replace('v3.4.0', APP_VERSION) template_content = template_content.replace('v3.4.0', APP_VERSION)
template_content = template_content.replace('v3.4.1', APP_VERSION) # 预留未来版本 template_content = template_content.replace('v3.4.1', APP_VERSION) # 预留未来版本
# 替换默认IP地址
template_content = template_content.replace("'192.168.2.17'", "'121.40.164.32'")
template_content = template_content.replace('"192.168.2.17"', '"121.40.164.32"')
return template_content return template_content
except: except:
# 如果文件不存在,返回基本模板 # 如果文件不存在,返回基本模板