fix: update email_client and smtp_client for new config structure - email_client: use account.imap.server/port/ssl/starttls instead of flat fields - smtp_client: use s.ssl/starttls instead of s.use_ssl/use_starttls - tg_bot: fix _do_send_reply to use find_user_by_chat_id for email_accounts

This commit is contained in:
2026-07-17 22:19:20 +08:00
parent c6180834bc
commit 7a01b29655
4 changed files with 15 additions and 10 deletions

View File

@@ -23,12 +23,12 @@ def send_reply(account: EmailAccount, to_addr: str, subject: str, body: str,
raise RuntimeError(f"账号 {account.username} 未配置 SMTP")
s = account.smtp
logger.info("SMTP 连接: %s:%d (ssl=%s)", s.server, s.port, s.use_ssl)
if s.use_ssl:
logger.info("SMTP 连接: %s:%d (ssl=%s)", s.server, s.port, s.ssl)
if s.ssl:
conn = smtplib.SMTP_SSL(s.server, s.port, timeout=15)
else:
conn = smtplib.SMTP(s.server, s.port, timeout=15)
if s.use_starttls:
if s.starttls:
conn.starttls()
conn.login(account.username, account.password)