RFC 1425

SMTP Service Extensions

๐Ÿ“… published February 1993, from ietf

SMTP Service Extensions ๐Ÿ’–๐Ÿ“ฌ

okay bestie, this one is the big-brain move that tells SMTP how to grow up without breaking everything ๐Ÿงš RFC 1425 from the Network Working Group (February 1993) ๐Ÿ’…

  • Authors: J. Klensin (WG Chair, United Nations University), N. Freed (Editor, Innosoft International, Inc.), M. Rose (Dover Beach Consulting, Inc.), E. Stefferud (Network Management Associates, Inc.), and D. Crocker (The Branch Office) ๐Ÿซถ
  • Category: IAB standards track protocol ๐Ÿ”ฅ
  • Obsoletes / Updates: the title block here doesn't list anything it obsoletes or updates, so there's nothing to report on that front ๐Ÿ™ˆ

Status of this Memo โœจ

So this is an IAB standards track protocol for the Internet community ๐ŸŒ, and it's literally asking people to discuss it and send suggestions for improvements ๐Ÿ’ฌ. For where this protocol's standardization state and status is at, check the current "IAB Official Protocol Standards" ๐Ÿ“‹. And distribution of this memo is unlimited ๐Ÿฆ‹.


1. Abstract ๐Ÿ’œ

This memo sets up a framework for extending the SMTP service ๐Ÿงฉ. The big idea is a way for a server SMTP to tell a client SMTP which service extensions it supports. Standard extensions get registered with the Internet Assigned Numbers Authority (IANA) ๐Ÿ—‚๏ธ. The best part? This framework does not require modification of existing SMTP clients or servers, unless the features of the service extensions are to be requested or provided ๐Ÿ˜ญโœจ


2. Introduction ๐ŸŽ€

The Simple Mail Transfer Protocol (SMTP) [1] has been a stable, effective base for the relay function of message transfer agents ๐Ÿ“ฎ. It's almost a decade old and has proven remarkably resilient ๐Ÿ’ช. Still, it's becoming clear that a bunch of protocol extensions are needed ๐Ÿ‘€. Instead of letting these extensions turn into separate, haphazard little islands, this document upgrades SMTP in a straightforward way ๐ŸŒธ. It gives everything that comes later one consistent framework to be built on, and that is iconic ๐Ÿ‘‘


3. Framework for SMTP Extensions ๐Ÿฆ‹

For service extensions to SMTP, SMTP relays a mail object that has an envelope and a content ๐Ÿ“ฆ. Here's the tea:

  1. The SMTP envelope is straightforward and gets sent as a series of SMTP protocol units. It has an originator address (where error reports should be directed ๐Ÿ“ฃ), a delivery mode (for example, deliver to recipient mailboxes), and one or more recipient addresses ๐Ÿ’Œ.
  2. The SMTP content is sent in the SMTP DATA protocol unit and has two parts: the headers and the body ๐Ÿ“„. The headers are a collection of field/value pairs structured according to RFC 822 [2], while the body, if it's structured, is defined according to MIME [3] ๐ŸŽจ. The content is textual, expressed using the US ASCII repertoire (ANSI X3.4-1986). Extensions like MIME may relax this restriction for the content body, but the content headers are always encoded using the US ASCII repertoire ๐Ÿ”ค. The algorithm defined in [4] is used to represent header values outside the US ASCII repertoire, while still encoding them using the US ASCII repertoire ๐Ÿง 

Although SMTP is widely and robustly deployed, some parts of the Internet community might want to extend the SMTP service ๐ŸŒˆ. This memo defines a way for an extended SMTP client and server to recognize each other as such, and for the server to tell the client which service extensions it supports ๐Ÿค

It must be emphasized that any extension to the SMTP service should not be considered lightly ๐Ÿ™…โ€โ™€๏ธ. SMTP's strength comes mainly from its simplicity ๐Ÿซถ. Experience with many protocols has shown that:

protocols with few options tend towards ubiquity, whilst
protocols with many options tend towards obscurity.
Translation: every single extension, no matter how good it sounds, must be carefully scrutinized for what it costs to implement, deploy, and make interoperable ๐Ÿ’€. In many cases, the cost of extending the SMTP service will likely outweigh the benefit ๐Ÿ˜ญ

Given all that, the framework for the extensions in this memo has three parts ๐Ÿงš:

  1. a new SMTP command (section 4)
  2. a registry of SMTP service extensions (section 5)
  3. additional parameters to the SMTP MAIL FROM and RCPT TO commands (section 6)

4. The EHLO command ๐ŸŒธ

A client SMTP that supports SMTP service extensions should start an SMTP session by issuing the EHLO command, not the HELO command ๐ŸŽ€. If the SMTP server supports the SMTP service extensions, it gives a successful response (see section 4.1), a failure response (see 4.2), or an error response (4.3) ๐Ÿ’–. If the SMTP server doesn't support any SMTP service extensions, it generates an error response (see section 4.4) ๐Ÿ™ˆ

The syntax for this command, using the ABNF notation of [2], is:

            ehlo-cmd ::= "EHLO" SP domain CR LF

A successful attempt gets code 250 โœ…. On failure, the server SMTP responds with code 550 โŒ. On error, it responds with one of codes 500, 501, 502, 504, or 421 ๐Ÿšจ

This command is used instead of HELO, and it may be issued any time a HELO command would make sense ๐Ÿ•ฐ๏ธ. So if EHLO goes through successfully, then any later HELO or EHLO will get a 503 back from the server ๐Ÿ™…โ€โ™€๏ธ. A client SMTP must not cache any information returned when the EHLO command succeeds ๐Ÿง . Put simply, a client SMTP must issue the EHLO command at the start of each SMTP session if it needs information about extended facilities ๐Ÿ’…


4.1. Successful response ๐Ÿ’Ž

If the server SMTP implements and can perform the EHLO command, it returns code 250 ๐Ÿฅณ. This means both the server and client SMTP are in the initial state: no transaction is in progress, and all state tables and buffers are cleared ๐Ÿงน

Usually this response is a multiline reply ๐Ÿ“œ. Each line has a keyword and, optionally, one or more parameters ๐Ÿ”‘. The syntax for a positive response, using the ABNF notation of [2], is:

         ehlo-ok-rsp  ::=      "250"    domain [ SP greeting ] CR LF
                        / (    "250-"   domain [ SP greeting ] CR LF
                            *( "250-"      ehlo-line           CR LF )
                               "250"    SP ehlo-line           CR LF   )

                      ; the usual HELO chit-chat
         greeting     ::= 1*<any character other than CR or LF>

         ehlo-line    ::= ehlo-keyword *( SP ehlo-param )

         ehlo-keyword ::= (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")

                      ; syntax and values depend on ehlo-keyword
         ehlo-param   ::= 1*<any CHAR excluding SP and all
                             control characters (US ASCII 0-31
                             inclusive)>

         ALPHA        ::= <any one of the 52 alphabetic characters
                           (A through Z in upper case, and,
                            a through z in lower case)>

         DIGIT        ::= <any one of the 10 numeric characters
                           (0 through 9)>

         CR           ::= <the carriage-return character
                           (ASCII decimal code 13)>
         LF           ::= <the line-feed character
                           (ASCII decimal code 10)>
         SP           ::= <the space character
                           (ASCII decimal code 32)>

EHLO keywords can be written in upper, lower, or mixed case, but they must always be recognized and processed in a case-insensitive way ๐Ÿ” . This is just an extension of practices that started in RFC 821 ๐Ÿ’ซ

The IANA keeps a registry of standard SMTP service extensions ๐Ÿ—ƒ๏ธ. Each one has a matching EHLO keyword value ๐Ÿ”—. Every service extension registered with the IANA is defined by a standards-track RFC, and that definition includes:

  1. the textual name of the SMTP service extension;
  2. the EHLO keyword value associated with the extension;
  3. the syntax and possible values of parameters associated with the EHLO keyword value;
  4. any additional SMTP verbs associated with the extension (additional verbs will usually be, but are not required to be, the same as the EHLO keyword value);
  5. any new parameters the extension associates with the MAIL FROM or RCPT TO verbs; and,
  6. how support for the extension affects the behavior of a server and client SMTP.

Also, any EHLO keyword value that starts with an upper or lower case "X" is a local SMTP service extension ๐Ÿ . It's used through bilateral agreement rather than standardization ๐Ÿค. Keywords beginning with "X" may not be used in a registered service extension ๐Ÿ™…โ€โ™€๏ธ

Any keyword values in the EHLO response that don't begin with "X" must correspond to an SMTP service extension registered with IANA โœ…. A conforming server must not offer non "X" prefixed keyword values that aren't described in a registered extension ๐Ÿšซ

Additional verbs follow the same rules as EHLO keywords ๐Ÿงพ. Basically, verbs beginning with "X" are local extensions that may not be standardized, and verbs not beginning with "X" must always be registered ๐Ÿ’…


4.2. Failure response ๐Ÿฅ€

If for some reason the server SMTP can't list the service extensions it supports, it returns code 554 ๐Ÿ˜ฌ

In the case of a failure response, the client SMTP should issue either the HELO or QUIT command ๐Ÿ™


4.3. Error responses from extended servers ๐Ÿšจ

If the server SMTP recognizes the EHLO command but the command argument is unacceptable, it returns code 501 ๐Ÿ™ƒ

If the server SMTP recognizes the EHLO command but doesn't implement it, it returns code 502 ๐Ÿ™ˆ

If the server SMTP determines that the SMTP service is no longer available (for example, because a system shutdown is imminent), it returns code 421 ๐Ÿ”Œ

In the case of any error response, the client SMTP should issue either the HELO or QUIT command ๐Ÿซถ


4.4. Responses from servers without extensions ๐Ÿซ 

A server SMTP that conforms to RFC 821 but doesn't support the extensions specified here won't recognize the EHLO command. It will therefore return code 500, as specified in RFC 821 ๐Ÿ’€


5. Initial IANA Registry ๐Ÿ—‚๏ธ๐Ÿ’–

The IANA's initial registry of SMTP service extensions has these entries ๐Ÿ“‹:

    Service Ext   EHLO Keyword Parameters Verb       Added Behavior
    ------------- ------------ ---------- ---------- ------------------
    Send             SEND         none       SEND    defined in RFC 821
    Send or Mail     SOML         none       SOML    defined in RFC 821
    Send and Mail    SAML         none       SAML    defined in RFC 821
    Expand           EXPN         none       EXPN    defined in RFC 821
    Help             HELP         none       HELP    defined in RFC 821
    Turn             TURN         none       TURN    defined in RFC 821

These match the SMTP commands that are defined as optional in [5]. (The mandatory SMTP commands, according to [5], are HELO, MAIL, RCPT, DATA, RSET, VRFY, NOOP, and QUIT.) ๐Ÿงš

6. MAIL FROM and RCPT TO Parameters โœจ

okay so the SMTP crew knows a bunch of future extensions are gonna want extra parameters tagged onto MAIL FROM and RCPT TO ๐ŸŽ€. think of them as accessories for the commands. so this section sets up the grammar for that, using the ABNF notation from [2] plus some underlying definitions from [1] ๐Ÿ’…

esmtp-cmd        ::= inner-esmtp-cmd [SP esmtp-parameters] CR LF
esmtp-parameters ::= esmtp-parameter *(SP esmtp-parameter)
esmtp-parameter  ::= esmtp-keyword ["=" esmtp-value]
esmtp-keyword    ::= (ALPHA / DIGIT) *(ALPHA / DIGIT / "-")

                     ; syntax and values depend on esmtp-keyword
esmtp-value      ::= 1*<any CHAR excluding "=", SP, and all
                        control characters (US ASCII 0-31
                        inclusive)>

                     ; The following commands are extended to
                     ; accept extended parameters.
inner-esmtp-cmd  ::= ("MAIL FROM:<" reverse-path ">")   /
                     ("RCPT TO:<" forward-path ">")

All esmtp-keyword values MUST be registered as part of the IANA registration process described above. Honestly this is just the framework for later ๐Ÿฆ‹. No extended MAIL FROM or RCPT TO parameters are defined by this RFC, so don't go hunting for any here ๐Ÿ™ˆ

6.1. Error responses ๐Ÿšจ

If the server SMTP doesn't recognize or can't implement one or more of the parameters on a MAIL FROM or RCPT TO command, it will return code 555.

If the server is temporarily unable to handle one or more of those parameters for some reason, and the definition of that specific parameter doesn't mandate a different code, it SHOULD return code 455.

Errors tied to a particular parameter and its values get spelled out in that parameter's own defining RFC ๐Ÿงš

7. Received: Header Field Annotation ๐Ÿ“จ

SMTP servers are REQUIRED to add an appropriate Received: field to the headers of every message they receive. A with ESMTP clause SHOULD be added to that field whenever any SMTP service extensions are used. And ESMTP is officially added to the list of standard protocol names registered with IANA ๐ŸŽ‰

8. Usage Examples ๐Ÿ“

three little vibe checks, bestie. let's see what the server is actually saying ๐Ÿ‘€

(1) An interaction of the form:

S: <wait for connection on TCP port 25>
C: <open connection to server>
S: 220 dbc.mtview.ca.us SMTP service ready
C: EHLO ymir.claremont.edu
S: 250 dbc.mtview.ca.us says hello
 ...

this one means the server SMTP only implements the SMTP commands that are defined as mandatory in [5]. basic, but make it cute ๐ŸŒธ

(2) In contrast, an interaction of the form:

S: <wait for connection on TCP port 25>
C: <open connection to server>
S: 220 dbc.mtview.ca.us SMTP service ready
C: EHLO ymir.claremont.edu
S: 250-dbc.mtview.ca.us says hello
S: 250-EXPN
S: 250-HELP
S: 250-8BITMIME
S: 250-XONE
S: 250 XVRB
 ...

this is giving main character energy ๐Ÿ‘‘. it means the server SMTP also implements the EXPN and HELP commands, one standard service extension (8BITMIME), and two non-standard service extensions (XONE and XVRB) โœจ

(3) Finally, a server that doesn't support SMTP service extensions would act like this:

S: <wait for connection on TCP port 25>
C: <open connection to server>
S: 220 dbc.mtview.ca.us SMTP service ready
C: EHLO ymir.claremont.edu
S: 500 Command not recognized: EHLO
 ...

so the 500 response means the server SMTP doesn't implement the extensions specified here ๐Ÿ’€. the client would normally send RSET to reset the connection, and, after getting a successful reply, send a HELO command and carry on as specified in RFC 821 ๐Ÿซถ

9. Security Considerations ๐Ÿ”’

okay this part is serious, so let's be real ๐Ÿฅบ. This RFC doesn't discuss security issues, and it isn't believed to raise any security issues that aren't already endemic in electronic mail and present in fully conforming implementations of RFC-821. It does announce server mail capabilities through the response to the EHLO verb ๐Ÿ“ฃ.

BUT. anything announced about the initial set of service extensions this RFC defines can be readily deduced by selectively probing the verbs needed to transport and deliver mail. so yeah, that info is basically discoverable ๐Ÿ’€. The security implications of service extensions described in other RFCs SHOULD be dealt with in those RFCs, so go check them ๐Ÿ™

10. Acknowledgements ๐Ÿ’œ

this doc is a synthesis of SO many people's ideas and reactions to each other's proposals ๐ŸŒˆ. Randall Atkinson, Craig Everhart, Risto Kankkunen, and Greg Vaudreuil contributed ideas and text good enough to count as co-authors ๐Ÿ‘‘. Other big contributors include Harald Alvestrand, Jim Conklin, Mark Crispin, Frank da Cruz, 'Olafur Gudmundsson, Per Hedeland, Christian Huitma, Neil Katin, Eliot Lear, Harold A. Miller, Dan Oscarsson, Julian Onions, Rayan Zachariassen, and the whole IETF SMTP Working Group ๐Ÿซถ.

Of course, none of those individuals are necessarily responsible for the combination of ideas here. honestly, sometimes the reply to a criticism was to accept the problem but come up with a totally different solution than the one first proposed ๐Ÿ™ˆ that's just how collab goes ๐Ÿฆ‹

11. References ๐Ÿ“š

  • [1] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821, USC/Information Sciences Institute, August 1982.
  • [2] Crocker, D., "Standard for the Format of ARPA Internet Text Messages", STD 11, RFC 822, UDEL, August 1982.
  • [3] Borenstein, N., and N. Freed, "Multipurpose Internet Mail Extensions", RFC 1341, Bellcore, Innosoft, June 1992.
  • [4] Moore, K., "Representation of Non-ASCII Text in Internet Message Headers", RFC 1342, University of Tennessee, June 1992.
  • [5] Braden, R., "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, USC/Information Sciences Institute, October 1989.

12. Chair, Editor, and Authors' Addresses ๐Ÿ’Œ

here's the squad behind it ๐Ÿงš (addresses copied exactly, even the spelling of "Moutain" ๐Ÿ™ˆ):

John Klensin, WG Chair
United Nations University
PO Box 500, Charles Street Station
Boston, MA 02114-0500  USA

Phone: +1 617 227 8747
Fax: +1 617 491 6266
Email: klensin@infoods.unu.edu


Ned Freed, Editor
Innosoft International, Inc.
250 West First Street, Suite 240
Claremont, CA 91711  USA

Phone: +1 909 624 7907
Fax: +1 909 621 5319
Email: ned@innosoft.com
Marshall T. Rose
Dover Beach Consulting, Inc.
420 Whisman Court
Moutain View, CA  94043-2186  USA

Phone: +1 415 968 1052
Fax: +1 415 968 2510
Email: mrose@dbc.mtview.ca.us


Einar A. Stefferud
Network Management Associates, Inc.
17301 Drey Lane
Huntington Beach, CA, 92647-5615  USA

Phone: +1 714 842 3711
Fax: +1 714 848 2091
Email: stef@nma.com


David H. Crocker
The Branch Office
USA

Email: dcrocker@mordor.stanford.edu
๐Ÿ“ฆ where this page comes from