更新邮件服务和SMTP配置功能

This commit is contained in:
2025-12-15 20:32:28 +08:00
parent 8846945208
commit 738eaa5211
21 changed files with 100 additions and 36 deletions

View File

@@ -530,6 +530,23 @@ def set_primary_smtp_config(config_id: int) -> bool:
return cursor.rowcount > 0
def clear_primary_smtp_config() -> bool:
"""取消主SMTP配置清空所有 is_primary 标记)"""
with db_pool.get_db() as conn:
cursor = conn.cursor()
cursor.execute(
"""
UPDATE smtp_configs
SET is_primary = 0,
updated_at = ?
WHERE is_primary = 1
""",
(get_beijing_now_str(),),
)
conn.commit()
return True
def _get_available_smtp_config(failover: bool = True) -> Optional[Dict[str, Any]]:
"""
获取可用的SMTP配置