Every mail server has a moment it would rather forget. The envelope is open. The sender is committed. One recipient has said yes, the second has said no, and the application upstairs has already changed its mind: this message should never leave the building.

The connection, however, is perfectly good. And SMTP has never been sentimental about throwing away a good connection.

Its answer, written into RFC 821 in 1982, was a three-letter act of selective amnesia: RSET. The command lets a server forget one unfinished message without hanging up on the conversation — and in doing so it quietly drew the line between a connection, a session and a transaction that the modern Internet still runs on.

The short version

  • RSET turns an unfinished SMTP message into a discardable transaction inside a longer-lived session: sender, recipients and content are cleared, and the server must not close the connection.
  • It is an acknowledged boundary, not a receipt. A reset says what was abandoned; it does not undo a delivered message, wipe the security context, or prove that anything was sent.

The recipient who changed the state

Picture the client. It has sent MAIL FROM, then two RCPT TO commands. The first recipient is accepted. The second is refused. The application has a rule — both or neither — and it has already decided the message is dead.

The rejected command, unfortunately, erased nothing. The server is still holding a reverse path and one forward path, and it has no idea that the plan changed. Send DATA now and the server dutifully continues a transaction the application has already abandoned. Send another MAIL immediately and you try to open a new envelope on top of an old one. Close the TCP connection and you have removed the ambiguity by removing the connection — turning a local change of plan into a transport failure, and paying a handshake for the privilege.

RSET gave the client a scalpel instead of a hammer. Abandon this mail transaction. The positive reply confirms the server has cleared the transaction-local state and is ready for a clean next step.

That small mechanism carries a large architectural idea, and it is worth naming plainly: a connection, an SMTP session and a mail transaction are related, but they are not the same object. Confusing them is how state leaks.

1982: Postel writes forgetting into the protocol

RSET was not a patch bolted on after the fact. RFC 821, Jon Postel's original specification, already described it: any stored sender, recipients and mail data had to be discarded, buffers and state tables cleared, and the receiver had to return an OK reply. The same document stated that a session could contain zero or more mail transactions.

Read those two sentences together and the design intent is obvious. SMTP was built to move several messages across one conversation, so it needed a way to abandon one message without declaring the entire conversation unusable. The command was never an afterthought for rare error handling. It was the operation that made the transaction boundary recoverable in the first place.

RFC 821 went further, telling both sides not to close the transmission channel merely because an earlier command had drawn an error. If a connection did vanish prematurely, the server was to cancel the pending transaction while preserving any already completed one. Even in 1982, the protocol kept three separate ledgers: the channel, the unfinished attempt, and the messages already accepted.

The reply is the boundary

Clearing a client-side queue is not enough. The server may be holding recipients the client no longer intends to use, and no client can peer into the server's buffers. Reuse becomes safe only when the peer acknowledges the reset.

RFC 5321 makes that acknowledgement precise: an argument-free RSET receives 250 OK. The command may be issued at any time. With no open transaction it is effectively a no-op; with transaction state present, sender, recipients and mail data are discarded. Most importantly, the server must not close the connection because it received RSET. Closing the channel belongs to QUIT, and to nobody else.

That 250 is not a delivery receipt. It approves the reset, not the message that preceded it. Nor does it promise cryptographic erasure of every internal byte. It establishes protocol-visible state: the abandoned transaction must not govern the next one.

What survives the forgetting

It is tempting to hear "all buffers and state tables cleared" and imagine RSET as amnesia for the whole session. The surrounding rules describe a much smaller blast radius.

The TCP connection stays open. The server does not repeat its greeting. The client does not have to rediscover every extension just to abandon a recipient set. TLS is not torn down. An authenticated identity does not quietly become anonymous. Rate limits, audit records and abuse observations are not defined as transaction-local mail data.

This is why RFC 5321 says a later accepted EHLO has the formal transaction-reset effect of RSET, yet normally costs more, because it also performs greeting and capability work. Both abort the open message. They are not interchangeable explanations of why the session state changed.

STARTTLS marks an even wider boundary. RFC 3207 requires both parties, after a successful TLS handshake, to discard knowledge learned before TLS and to re-establish capabilities with EHLO. The security context changed, so the protocol deliberately refuses to carry old knowledge across it. RSET earns its keep precisely because most abandoned messages do not deserve that wider renegotiation.

Transactions do not roll backward in time

A reset applies to the current unfinished transaction. It does not retract one that already concluded successfully.

RFC 5321 describes a mail transaction as a beginning command, one or more recipient commands and a content transfer. A session can hold zero or more of them. Once the final content has been accepted, the message belongs to a completed transaction. A later reset may prepare the session for the next message, but it cannot turn that earlier acceptance into a non-acceptance.

The limit matters, because it blocks a dangerous reading of persistent connections. A session is not a database transaction spanning every message sent over it. Each completed message carries its own acceptance result. A reset cancels the live envelope; it does not rewrite history.

Pipelining sharpened the line

Command pipelining let clients fire selected SMTP commands without waiting after each line. RFC 2920 permits RSET, sender commands and RCPT TO inside a single command group. It even permits the last content of one message and a reset-plus-new-sender sequence for the next to share a group.

That overlap does not dissolve transaction boundaries. It makes response correlation essential. Every command still has a reply, in order, and the client must account for all of them. If the final content fails, if the reset fails, if the new sender is rejected — those are three different outcomes wearing the same TCP stream.

A fast client therefore cannot simply empty its local buffers and assume the server crossed the same boundary at the same instant. It has to know which reply acknowledged the previous content, which reply acknowledged the reset, and which reply opened the next envelope.

CHUNKING made cleanup visible — and AUTH drew the opposite line

The CHUNKING extension put the cleanup role on stage. RFC 3030 lets content arrive as one or more BDAT chunks. Certain sequence errors — another chunk after BDAT LAST, mixing DATA and BDAT in one transaction, or a failed chunk that leaves transaction state indeterminate — require RSET before anything else proceeds.

Here the reset is not ceremonial. It tells both sides that partial chunks and the envelope around them no longer belong to a live message. The same session may later carry a properly framed message, but only after a clean transaction boundary has been acknowledged.

Authentication follows the opposite rule. RFC 4954 forbids AUTH during an open mail transaction and requires rejection with 503. Identity has a wider scope than one envelope, so the protocol will not let a client splice a fresh authentication event into the middle of the sender-recipient-data sequence.

Why the smallest command still matters

Network protocols tend to recover in one of two crude ways: ignore the fault and hope both ends still agree, or discard the entire connection and start over. RSET occupies the useful space between them. It names the state that may be abandoned and asks the peer to acknowledge the new boundary.

The design holds because its promise is limited. The unfinished message can be forgotten. The conversation can continue. Completed messages stay completed. Security and capability context survive unless a different command changes them. The next envelope starts clean, inheriting neither the last sender, nor the last recipients, nor the last half-written content.

SMTP did not make state harmless. It made state divisible.

Sources