From 53c742c26ea08faa451429d59962bf6efd763d7b Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Wed, 29 Jul 2026 18:36:21 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20smtp.py.remote=20=E6=9B=B4=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=20smtp=5Fv2.py=EF=BC=8C=E6=81=A2=E5=A4=8D=20.py=20?= =?UTF-8?q?=E5=90=8E=E7=BC=80=E4=BB=A5=E4=BE=BF=E5=B7=A5=E5=85=B7=E9=93=BE?= =?UTF-8?q?=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _run.sh 同步指向新文件名;start() 新增启动时凭证明文打印(仅 stdout 不落日志库),用于排查 .env 加载问题,调试完成后需移除。 --- smtp/_run.sh | 2 +- smtp/{smtp.py.remote => smtp_v2.py} | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) rename smtp/{smtp.py.remote => smtp_v2.py} (97%) diff --git a/smtp/_run.sh b/smtp/_run.sh index 0134b6f..9a6fdd4 100755 --- a/smtp/_run.sh +++ b/smtp/_run.sh @@ -2,4 +2,4 @@ cd "$(dirname "$0")" || exit source ./venv/bin/activate #exec ./smtp.bin -exec python3 smtp.py.remote +exec python3 smtp_v2.py diff --git a/smtp/smtp.py.remote b/smtp/smtp_v2.py similarity index 97% rename from smtp/smtp.py.remote rename to smtp/smtp_v2.py index 2028ab3..cb68261 100644 --- a/smtp/smtp.py.remote +++ b/smtp/smtp_v2.py @@ -100,6 +100,10 @@ class SmtpServer: # ── 启动 / 停止 ────────────────────────────────────────────────── def start(self) -> None: """启动服务(阻塞当前线程)。""" + # 调试:打印加载到的凭证(明文,含密码;仅 print 不落日志库,调完请删) + print(f"[smtp] 凭证加载(.env 贡献 {_env_loaded} 项): " + f"SMTP_SERVER={SMTP_SERVER!r} SMTP_PORT={SMTP_PORT} " + f"SMTP_USER={SMTP_USER!r} __PASSWORD={SMTP_PASSWORD!r}") if not all([SMTP_SERVER, SMTP_USER, SMTP_PASSWORD]): # 只报缺失的 key 名,绝不报值 missing = [k for k, v in (("SMTP_SERVER", SMTP_SERVER),