修复邮件系统保存邮件的问题:1. 添加邮箱ID查询逻辑 2. 调整SMTP客户端连接方式

This commit is contained in:
huangzhenpc
2025-02-26 11:31:21 +08:00
parent 89bd832dde
commit e5ffc6310d
2 changed files with 32 additions and 2 deletions

View File

@@ -49,7 +49,8 @@ def send_verification_email(smtp_host, smtp_port, to_email):
# 连接SMTP服务器并发送
try:
server = smtplib.SMTP(smtp_host, smtp_port)
# 使用显式的源地址
server = smtplib.SMTP(smtp_host, smtp_port, timeout=30, source_address=('127.0.0.1', 0))
server.set_debuglevel(1) # 开启调试模式
print(f"连接到SMTP服务器: {smtp_host}:{smtp_port}")