RFC 1425
SMTP Service Extensions
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:
- 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 ๐.
- 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 ๐ง:
- a new SMTP command (section 4)
- a registry of SMTP service extensions (section 5)
- 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:
- the textual name of the SMTP service extension;
- the EHLO keyword value associated with the extension;
- the syntax and possible values of parameters associated with the EHLO keyword value;
- 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);
- any new parameters the extension associates with the MAIL FROM or RCPT TO verbs; and,
- 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
- ietf: rfc1425 1993-02
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms