更新邮件页面和管理API

This commit is contained in:
2025-12-15 17:16:56 +08:00
parent 49897081b6
commit 8846945208
19 changed files with 170 additions and 37 deletions

View File

@@ -1067,13 +1067,13 @@ def test_smtp_config_api(config_id):
"""测试SMTP配置"""
try:
data = request.json or {}
test_email = data.get("email", "")
test_email = str(data.get("email", "") or "").strip()
if not test_email:
return jsonify({"error": "请提供测试邮箱"}), 400
import re
if not re.match(r"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$", test_email):
if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", test_email):
return jsonify({"error": "邮箱格式不正确"}), 400
result = email_service.test_smtp_config(config_id, test_email)