← RFC Reference

RFC 2920 – SMTP Pipelining

Internet Standard (STD 60) Core SMTP & Message Format Published September 2000
ELI5: Normal SMTP is like a conversation where you say one sentence, wait for the other person to respond, then say the next sentence. Pipelining is like rattling off several sentences in a row and letting the other person respond to all of them at once. You don’t have to pause between each command, so the whole conversation finishes much faster — especially when the two sides are far apart.

Why This RFC Exists

Standard SMTP is a strict request-response protocol. The client sends one command, waits for the server's response, then sends the next. Each round trip adds latency, especially across high-latency network links. For a message with 50 recipients, the client would need 50 separate round trips just for the RCPT TO commands.

RFC 2920 defines the PIPELINING SMTP extension, which allows the client to send multiple commands in a batch without waiting for individual responses. The server buffers and processes the commands in order, then sends all responses back. This dramatically reduces the total time for an SMTP session.

Pipelining is one of the most widely supported SMTP extensions. Nearly every modern mail server advertises it, and most SMTP client libraries use it by default.

How It Works

  1. The client sends EHLO and confirms the server advertises PIPELINING in its capability list.
  2. The client groups together commands that are safe to pipeline — typically MAIL FROM, one or more RCPT TO, and DATA.
  3. The client sends all these commands in rapid succession without waiting for individual replies.
  4. The server processes each command in order and sends back one response per command, in order.
  5. The client reads all responses and handles any errors (e.g., a rejected recipient).

SMTP Example

Without pipelining (5 round trips for the envelope):

C: MAIL FROM:<news@example.com> S: 250 2.1.0 OK C: RCPT TO:<alice@recipient.com> S: 250 2.1.5 OK C: RCPT TO:<bob@recipient.com> S: 250 2.1.5 OK C: RCPT TO:<carol@recipient.com> S: 550 5.1.1 User unknown C: DATA S: 354 Start mail input

With pipelining (1 round trip for the entire envelope):

# Client sends all envelope commands at once C: MAIL FROM:<news@example.com> C: RCPT TO:<alice@recipient.com> C: RCPT TO:<bob@recipient.com> C: RCPT TO:<carol@recipient.com> C: DATA # Server responds to all five commands in order S: 250 2.1.0 OK S: 250 2.1.5 OK S: 250 2.1.5 OK S: 550 5.1.1 User unknown S: 354 Start mail input # Client sends message data (carol was rejected, but alice and bob proceed) C: Subject: Weekly update C: C: This week's news... C: . S: 250 2.0.0 OK, queued

Key Technical Details

Which Commands Can Be Pipelined

Not all SMTP commands are safe to pipeline. RFC 2920 divides commands into two categories:

Safe to Pipeline Must Wait for Response
MAIL FROM EHLO / HELO
RCPT TO STARTTLS
DATA AUTH
RSET QUIT
NOOP DATA content (the dot-stuffed body)

Commands that change the connection state (EHLO, STARTTLS, AUTH) are synchronization points — the client must wait for the response before sending anything else.

Error Handling

When pipelining, some commands in a batch may succeed while others fail. The client must match responses to commands in order. A rejected RCPT TO does not invalidate the entire transaction — the message is still delivered to the accepted recipients. However, if MAIL FROM is rejected, subsequent RCPT TO commands will also fail.

TCP Buffering Considerations

Pipelining relies on TCP's buffering. The client writes multiple commands to the socket without reading, trusting that the TCP send buffer can hold them. For very large batches of RCPT TO commands (hundreds or thousands), the client may need to pipeline in groups to avoid filling the TCP buffer and deadlocking.

Interaction with STARTTLS

After an EHLO response that includes STARTTLS, the client must not pipeline STARTTLS with other commands. The TLS handshake changes the state of the entire connection, so it's a hard synchronization point. After TLS is established and a new EHLO is sent, pipelining can resume.

Common Mistakes

Deliverability Impact

Related RFCs