Repository navigation
Conversation
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.
问题
已认证的 SMTP 客户端提交邮件时,
Session.Data会同步调用send.Send。如果下游投递失败,PMail 虽然会在自己的数据库中记录status=2,但函数最后仍会执行return nil。因此提交方收到的是 DATA 成功响应,无法区分邮件已经成功投递、被下游拒绝,还是暂时无法投递。出站 SMTP 客户端还存在一个相关边界:下游服务器返回 DATA 最终
250响应时,已经正式接收该邮件并承担后续责任。此后即使没有返回 QUIT 的221响应,或 QUIT 发生错误,也不能把已经被接收的邮件重新判定为投递失败,否则上游重试可能造成重复邮件。修改内容
Session.Data发送路径中,把同步下游投递错误返回给提交方。451 4.4.0,允许提交方重试。550 5.0.0,包括 SMTP 5xx 响应和 NXDOMAIN。250响应作为投递结果;随后只执行有写入超时限制的尽力 QUIT,不等待221响应。入站收信路径及现有 SPF/DKIM 认证追踪逻辑保持不变。本修复不需要新增配置或数据库迁移。
已知限制
PMail 会在向提交方返回一个 DATA 状态之前,同步向多个收件域投递邮件。如果某个域已经成功接收,而另一个域发生临时失败,事务级
451可能使提交方重试整封邮件,从而让已经成功的收件人再次收到邮件。在 PMail 具备可按域记录重试状态的内部投递队列之前,需要精确重试行为的客户端应在每个 SMTP 事务中只提交一个收件域。测试
250但不返回 QUIT 响应时仍判定投递成功。已执行: