Fix multi-recipient email delivery and SMTP cleanup - #118
Open
ai-yang wants to merge 1 commit into
Open
Conversation
|
ai-yang
marked this pull request as ready for review
July 31, 2026 15:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
quit()成功后返回True。Motivation and Context
原实现位于收件人循环内的
return True使多收件人列表只发送首位地址,并绕过正常路径的server.quit()。连接、登录或发送发生异常时也没有可靠的清理路径,可能泄漏 SMTP 连接,同时向调用者错误表示全部发送成功。Related issue: none. 上游当前限制此账号创建 Issue(GitHub API 返回 403),因此复现、根因和测试信息完整记录在本 PR 中。
How Has This Been Tested?
pytest -q tests/test_send_email.py:7 passedpython -m unittest -q tests.test_send_email:连续 3 次通过python -m py_compile utils/send_email.py tests/test_send_email.pyflake8 --select=E9,F63,F7,F82 utils/send_email.py tests/test_send_email.pygit diff --check origin/main...HEAD测试使用 fake SMTP,覆盖两个收件人、正常关闭、发送/登录/TLS/连接失败时关闭、
quit失败不覆盖原异常,以及空收件人不创建连接。全仓
compileall当前仍会报告数据工具非法方法签名和期货示例 Python 2 语法;两者均存在于上游基线、不由本 PR 引入,并已拆分为独立修复。未运行模板中提到的裸全仓 pipeline 测试:当前仓库部分测试包含联网、真实邮件、交易入口或无限循环风险。本 PR 的回归测试全部离线执行。
Types of changes