RFC 1651

SMTP Service Extensions

๐Ÿ“… published July 1994, from ietf

SMTP Service Extensions ๐Ÿ“ฎโœจ

okay bestie, this is RFC 1651 and it's giving Standards Track ๐Ÿ’… It's from the Network Working Group and came out in July 1994. The people behind it are J. Klensin (WG Chair, MCI), N. Freed (Editor, Innosoft), M. Rose (Dover Beach Consulting, Inc.), E. Stefferud (Network Management Associates, Inc.), and D. Crocker (Silicon Graphics, Inc.). It obsoletes RFC 1425 ๐Ÿซถ

Status of this Memo ๐Ÿงพ

this bit is the official stuff, but it matters! This doc specifies an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐Ÿ’Œ For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited ๐Ÿฆ‹

1. Abstract โœจ

okay so the big idea: this memo builds a framework for extending the SMTP service ๐ŸŽ€ It gives a way for a server SMTP to tell a client SMTP which service extensions it supports. Standard extensions get registered with the IANA. The best part is that this framework doesn't require existing SMTP clients or servers to change, unless someone actually wants to request or provide the features of the service extensions ๐ŸŒธ

2. Introduction ๐ŸŒท

SMTP [1] has been a stable, effective basis for the relay function of message transfer agents, and honestly? It's been remarkably resilient for a decade now ๐Ÿ’– Still, it's obvious that a bunch of protocol extensions are needed. Instead of bolting on random, haphazard extensions, this document upgrades SMTP in a straightforward way ๐Ÿงš It gives a framework that all future extensions can be built on in one consistent way. main character energy for the whole protocol โœจ

3. Framework for SMTP Extensions ๐Ÿ“ฌ

so for extensions, SMTP relays a mail object that has an envelope and a content:

  1. The envelope is simple and gets sent as a series of SMTP protocol units. It has an originator address (where error reports should go), a delivery mode (e.g., deliver to recipient mailboxes), and one or more recipient addresses.
  2. The content goes in the SMTP DATA protocol unit and has two parts: the headers and the body. The headers are field/value pairs structured according to STD 11, RFC 822 [2], and the body, if it's structured, is defined according to MIME [3]. The content is textual and uses the US-ASCII repertoire (ANSI X3.4-1986). Extensions like MIME can relax this restriction for the content body, but the content headers are always encoded with US-ASCII. The algorithm in [4] is used to represent header values outside the US-ASCII repertoire while still encoding them with US-ASCII ๐Ÿซถ

Even though 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 extended, and for the server to tell the client which service extensions it supports.

bestie listen, 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.

So this means each and every extension, no matter how good its benefits are, MUST be carefully scrutinized for its implementation, deployment, and interoperability costs. In lots of 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 ๐Ÿ“จ

okay so a client SMTP that supports SMTP service extensions SHOULD start its SMTP session by issuing the EHLO command instead of the HELO command ๐ŸŽ€ If the SMTP server supports the extensions, it gives a successful response (see section 4.3), a failure response (see 4.4), or an error response (4.5). If the SMTP server doesn't support any SMTP service extensions, it generates an error response (see section 4.5) ๐Ÿ™ˆ

4.1. Changes to STD 10, RFC 821 ๐Ÿ’…

STD 10, RFC 821 says the first command in an SMTP session MUST be the HELO command. This requirement is hereby amended so a session can start with either EHLO or HELO ๐Ÿฆ‹

4.2. Command syntax ๐Ÿงฉ

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

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

If it's successful, the server SMTP responds with code 250. On failure, it responds with code 550. On error, it responds with one of codes 500, 501, 502, 504, or 421 โœจ

This command is issued instead of the HELO command, and it MAY be issued at any time a HELO command would be appropriate. That means if the EHLO command is issued and a successful response comes back, then a later HELO or EHLO command will get the server SMTP replying with code 503 ๐Ÿ™… A client SMTP MUST NOT cache any information returned if the EHLO command succeeds. In other words, a client SMTP MUST issue the EHLO command at the start of each SMTP session if it needs information about extended facilities ๐Ÿซถ

4.3. 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 ๐ŸŒˆ

Normally 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)>

Even though EHLO keywords MAY be specified in upper, lower, or mixed case, they MUST always be recognized and processed in a case-insensitive manner. This is just an extension of what was 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" refers to a local SMTP service extension, 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 do NOT begin with "X" MUST correspond to a standard or standards-track SMTP service extension registered with the IANA. A conforming server MUST NOT offer non "X" prefixed keyword values that aren't described in a registered and standardized extension ๐Ÿ”ฅ

Additional verbs follow the same rules as EHLO keywords. Specifically, verbs beginning with "X" are local extensions that may not be standardized, and verbs not beginning with "X" MUST always be registered ๐Ÿ’–

4.4. 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.5. 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 decides the SMTP service is no longer available (e.g., due to imminent system shutdown), it returns code 421 ๐Ÿ’€

In the case of any error response, the client SMTP SHOULD issue either the HELO or QUIT command.

4.6. 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, so it returns code 500, as specified in RFC 821. The server SMTP SHOULD stay in the same state after returning this code (see section 4.1.1 of RFC 821). The client SMTP MAY then issue either a HELO or a QUIT command ๐ŸŒท

that's part 1, bestie! ๐Ÿ’… Part 2 is coming with the rest of the spec ๐Ÿซถโœจ

4.7. Responses from improperly implemented servers ๐Ÿ™ˆ

okay bestie, some SMTP servers are known to just hang up (disconnect the SMTP transmission channel) the moment they get EHLO ๐Ÿ’€ It can happen right away or after they've already sent a response. This is lowkey a violation of section 4.1.1 of RFC 821, which explicitly says disconnection SHOULD only occur after a QUIT command is issued. Rude. ๐Ÿ˜ค

Still, for max interoperability, it's suggested that extended SMTP clients using EHLO be coded to check whether the server closed the connection after EHLO was sent, either before or after returning a reply. If that happens, the client MUST decide whether the operation can be successfully completed without using any SMTP extensions. If it can, a new connection can be opened and the HELO command can be used. ๐Ÿงš

Other improperly-implemented servers won't accept a HELO command after EHLO has been sent and rejected. In some cases you can work around this by sending an RSET after the failure response to EHLO, then sending the HELO. Clients doing this SHOULD be aware that many implementations will return a failure code (e.g., 503 Bad sequence of commands) in response to the RSET. That code can be safely ignored, so no panic ๐Ÿ’…


5. Initial IANA Registry ๐Ÿ“’

The IANA's initial registry of SMTP service extensions consists of 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 correspond to those SMTP commands which are defined as optional in [5]. (The mandatory SMTP commands, according to [5], are HELO, MAIL, RCPT, DATA, RSET, VRFY, NOOP, and QUIT.) The core crew is giving main character energy ๐Ÿ‘‘


6. MAIL FROM and RCPT TO Parameters ๐Ÿ’Œ

It is recognized that several of the extensions planned for SMTP will make use of additional parameters associated with the MAIL FROM and RCPT TO commands. The syntax for these commands, again using the ABNF notation of [2] as well as underlying definitions from [1], is:

  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. This definition only provides the framework for future extension; no extended MAIL FROM or RCPT TO parameters are defined by this RFC. โœจ

6.1. Error responses ๐Ÿšจ

If the server SMTP does not recognize or cannot implement one or more of the parameters associated with a particular MAIL FROM or RCPT TO command, it will return code 555.

If for some reason the server is temporarily unable to accommodate one or more of the parameters associated with a MAIL FROM or RCPT TO command, and if the definition of the specific parameter does not mandate the use of another code, it SHOULD return code 455.

Errors specific to particular parameters and their values will be specified in the parameter's defining RFC. ๐Ÿ“


7. Received: Header Field Annotation ๐Ÿ“จ

SMTP servers are REQUIRED to add an appropriate Received: field to the headers of all messages they receive. A "with ESMTP" clause SHOULD be added to this field when any SMTP service extensions are used. "ESMTP" is hereby added to the list of standard protocol names registered with IANA. ๐ŸŽ€


8. Usage Examples ๐ŸŽฌ

(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
 ...

indicates that the server SMTP implements only those SMTP commands which are defined as mandatory in [5]. Basic vibes, no extras ๐Ÿฅฑ

(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
 ...

indicates that the server SMTP also implements the SMTP EXPN and HELP commands, one standard service extension (8BITMIME), and two non-standard service extensions (XONE and XVRB). Look at this server showing off ๐ŸŒˆ๐Ÿฆ‹

(3) Finally, a server that does not support SMTP service extensions would act as follows:

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
 ...

The 500 response indicates that the server SMTP does not implement the extensions specified here. The client would normally send a HELO command and proceed as specified in RFC 821. See section 4.7 for additional discussion. ๐Ÿงƒ


9. Security Considerations ๐Ÿ”

This RFC does not discuss security issues. It is not believed to raise any security issues not already endemic in electronic mail and present in fully conforming implementations of RFC-821. It does provide an announcement of server mail capabilities via the response to the EHLO verb. However, all information provided by announcement of any of the initial set of service extensions defined by this RFC can be readily deduced by selective probing of the verbs required to transport and deliver mail. The security implications of service extensions described in other RFCs SHOULD be dealt with in those RFCs.

Translation: the extension announcements aren't a secret, anyone can poke around and figure them out, so the bigger security stories belong in the RFCs for each extension ๐Ÿ‘€


10. Acknowledgements ๐Ÿซถ

This document is a synthesis of the ideas of many people and reactions to the ideas and proposals of others. Randall Atkinson, Craig Everhart, Risto Kankkunen, and Greg Vaudreuil contributed ideas and text sufficient to be considered co-authors. Other important suggestions, text, or encouragement came from 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 contributions of the entire IETF SMTP Working Group. Of course, none of the individuals are necessarily responsible for the combination of ideas represented here. Indeed, in some cases, the response to a particular criticism was to accept the problem identification but to include an entirely different solution from the one originally proposed. ๐Ÿ’œ


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 1521, Bellcore, Innosoft, September 1993.

[4] Moore, K., "Representation of Non-ASCII Text in Internet Message Headers", RFC 1522, University of Tennessee, September 1993.

[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 ๐Ÿก

John Klensin, WG Chair
MCI Data Services Division
2100 Reston Parkway, 6th floor
Reston, VA 22091
USA

Phone:: 1 703 715 7361
Fax: +1 703 715 7435
EMail: klensin@mci.net


Ned Freed, Editor
Innosoft International, Inc.
1050 East Garvey Avenue South
West Covina, CA 91790
USA

Phone:: +1 818 919 3600
Fax: +1 818 919 3614
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


Dave Crocker
Silicon Graphics, Inc.
2011 N. Shoreline Blvd.
P.O. Box 7311
Mountain View, CA 94039
USA

Phone: +1 415 390 1804
Fax: +1 415 962 8404
EMail: dcrocker@sgi.com

and that's the whole spec, bestie! ๐ŸŽ‰๐Ÿ’–

๐Ÿ“ฆ where this page comes from