以下是我从 RFC 5321 中收集到的内容:
4.1.1.5。复位(RSET)
此命令指定当前邮件事务将被中止。必须丢弃任何存储的发件人、收件人和邮件数据,并清除所有缓冲区和状态表。接收者必须发送一个“250 OK”回复到一个不带参数的 RSET 命令。客户端可以随时发出重置命令。如果在 EHLO 之后立即发出,在会话中发出 EHLO 之前,在发送并确认数据结束指示符之后,或在 QUIT 之前立即发出,它实际上等效于 NOOP(即,它没有效果) 。
重点是我的。这表示如果我们在数据结束指示符“.”之后收到 RSET,但在我们发送确认之前,那么我们必须丢弃当前正在传递的消息内容。这似乎不切实际。此外,服务器可以很容易地表现得好像它在发送确认后收到了 RSET - 客户端将无法知道。试图知道通常会做什么,我发现这个讨论https://www.ietf.org/mail-archive/web/ietf-smtp/current/msg00946.html他们说:
Under a RFC5321 compliant "No Quit/Mail" cancellation implementation, after
completing the DATA state, the server is waiting for a pending RSET, MAIL
or QUIT command:
QUIT - complete transaction, if any
MAIL - complete transaction, if any
perform a "reset"
RSET - cancel any pending DATA transaction delivery,
perform a "reset"
drop - cancel any pending DATA transaction delivery
We added this support in 2008 as a local policy option (EnableNoQuitCancel)
which will alter your SMTP state flow, your optimization and now you MUST
follow RSET vs QUIT/MAIL correctly. RSET (after DATA) aborts the
transaction, QUIT/MAIL (after DATA) does not. RSET is not an NOOP at this
point.
规范说丢弃是必须的。然而,上述摘录表明在实践中它被解释为 MAY。我可以查看已知的 SMTP/LMTP 实现的代码,例如 Dovecot,但也许有人已经对其进行了审查,这样可以节省我的时间。