SMTP pipelining

Command pipelining is an extension to SMTP, the simple mail transport protocol, which speeds up the normal back and forth communication by sending multiple commands in a batch without waiting for a response to each one.

The pipelining service extension is outlined in RFC 2920, which is STD 60. The SMTP protocol was extended in STD 10 to support additional optional functionality. This SMTP service extensions has an extended client use the EHLO command to start an SMTP session to see if the server supports any SMTP extensions and if so, which ones. You can test which SMTP extensions your e-mail service advertises by connecting to it and sending it an EHLO command. The server will respond saying that it's an unrecognized command, or with the SMTP extensions that it supports. For example:

250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 104857600
250-DSN
250-STARTTLS
250-DELIVERBY
250 HELP

Without using pipelining, the SMTP session would then continue like this, with the client and server taking turns. The client sends a command, and then the server sends its response to that command:

MAIL FROM: <support@example.com>
250 2.1.0 <support@example>... Sender ok
RCPT TO: <support@example.com>
250 2.1.5 <support@example.com>... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself

Since this e-mail server advertises that it supports command pipelining, the client can instead send all of its commands in a batch like this:

MAIL FROM: <support@example.com>
RCPT TO: <support@example.com>
DATA

The server then responds to each command individually. This has significant speed advantages over the normal back and forth communiation of an SMTP session.

I'm writing about this today because we sometimes send a network trace to a client that uses pipelining and then get mistakenly blamed for violating the SMTP protocol by sending series of commands without waiting for a response from the previous command. We then explain that their e-mail server advertised that it supported pipelining and spend some time educating our clients on what pipelining is.

We have also seen instances where an e-mail server would advertise that it supports pipelining, but then not actually support it. Unfortunately the e-mail server administrator didn't realize the significance of advertising pipelining after the EHLO command.

I've found that many of my colleagues aren't that familiar with SMTP extensions or pipelining. Now that you've read this article, you won't be one of them.