RFC 2852
Deliver By SMTP Service Extension
Deliver By SMTP Service Extension ๐ฌ
Okay bestie, this is RFC 2852 ๐, and it's called "Deliver By SMTP Service Extension" ๐. It was written by D. Newman at Sun Microsystems, dated June 2000, and it's a Standards Track doc ๐ฅ. It updates RFC 1894 โจ.
Status of This Memo โจ
So this is an Internet standards track protocol for the Internet community ๐, and they're literally asking for discussion and suggestions ๐ซถ. To find where it stands, check the current edition of "Internet Official Protocol Standards" (STD 1) ๐. Distribution of this memo is unlimited ๐.
Copyright Notice ๐
Copyright (C) The Internet Society (2000). All Rights Reserved. ๐
Abstract ๐ฆ
Here's the vibe: this memo defines a way for an SMTP client ๐ to ask an SMTP server, when it sends a message, to deliver that message within a set amount of time โฐ. The client also picks what happens if the deadline gets missed. Either the message gets returned as undeliverable with no further processing ๐ , or a "delayed" delivery status notification (DSN) [6] gets issued ๐.
This extension is not a way to ask for "priority" processing, bestie ๐ซ๐ . A receiving SMTP server can give the message whatever processing priority it wants, even if the message came with a Deliver By request ๐คท. What a Deliver By request actually does is show how urgent a message is and add a bit more predictability to how it's handled โจ. If someone asks about an urgent message's status within a given time period, that request can be made and it will be honored ๐ซถ. The message can also get withdrawn if it isn't delivered in that window ๐๏ธ.
A typical use is stopping a message from being delivered past some future moment that matters to the sender or recipient, but that the MTAs handling it don't know about ๐. Like, the sender knows the message will show up as a page, but doesn't think it's important enough to page the recipient after hours ๐ค. So they mark it so delivery attempts aren't made past 17:00 ๐.
Another super common one is when a sender wants to hear about delivery delays ๐ฃ. They mark the message so that if it isn't delivered within, say, 30 minutes, a "delayed" DSN gets generated, but delivery attempts keep going anyway ๐. The sender gets to pick when they want to learn about delivery problems. Main character energy ๐.
1. Definitions ๐
Throughout this doc, "deliver" means the act of transmitting a message to its "final" destination by a message transport agent (MTA) ๐. Usually, though not always, that means storing the message or handing it off to the recipient's mailbox ๐ฅ. So an MTA that accepts a message to be delivered within a specified time period is promising to store or hand it off to the recipient's mailbox within that window ๐ค. Anything that happens after the MTA stores or hands off the message is outside "deliver" ๐ โโ๏ธ. Think user-programmed filters that, often without the MTA knowing, resend the message somewhere else ๐.
Quick note on the capital-letter words ๐ : the key words "MUST", "MUST NOT", "SHOULD" and "SHOULD NOT" in this document are to be interpreted as described in RFC 2119 [7].
2. Framework for the Deliver By SMTP service extension ๐งฉ
The Deliver By extension uses the SMTP service extension mechanism described in [4] ๐. So the following SMTP service extension gets defined:
(1) The name of the SMTP service extension is "Deliver By".
(2) The EHLO keyword value associated with this service extension is "DELIVERBY".
(3) One optional parameter is allowed with this EHLO keyword value ๐. It's a comma separated list of options. Only one option, a min-by-time, is specified in this document. Future documents may extend this specification by adding more options ๐ฎ. The min-by-time is a fixed integer showing the fixed minimum by-time that the server will accept when a by-mode of "R" is specified, as per Section 4 โณ.
Here's the syntax for that optional parameter, using the augmented BNF notation of RFC 2234 [2] ๐งพ:
deliverby-param = min-by-time *( ',' extension-token )
min-by-time = [1*9DIGIT]
extension-token = 1*<any CHAR excluding SP, COMMA and all control
characters (US ASCII 0-31 inclusive)>
SP = <the space character (ASCII decimal code 32)>
COMMA = <the comma character (ASCII decimal code 44)>
If the parameter is omitted, no information is conveyed about the server's fixed minimum by-time ๐ค.
(4) One optional parameter using the keyword "BY" is added to the MAIL FROM command ๐.
(5) The maximum length of a MAIL FROM command line increases by 17 characters, thanks to the possible addition of the BY keyword and value ๐.
(6) No additional SMTP verbs are defined by this extension ๐ .
3. The Deliver By SMTP service extension ๐ฆ
An SMTP client that wants to use Deliver By can issue the EHLO command to start an SMTP session and find out whether the server supports the extension ๐. If the server responds with code 250 to the EHLO command, and the response includes the EHLO keyword DELIVERBY, then yep, the Deliver By extension is supported by the server ๐.
If a numeric parameter follows the DELIVERBY keyword value in the EHLO response, that number is the minimum by-time allowed when a by-mode of "R" is specified with the extended MAIL FROM command, as described in Section 4 ๐ข. Any client that tries a by-mode of "R" with a by-time strictly less than this limit, min-by-time, gets rejected with a permanent failure (55z) reply code ๐ซ.
An SMTP server that supports the Deliver By extension will accept the extended version of the MAIL FROM command described in Section 4 ๐. When the server supports it, an SMTP client can use the extended MAIL FROM command (instead of the MAIL FROM command described in [1]) to ask that the message be delivered within the specified time period ๐ฎ. The server may then return an appropriate error code if it decides the request can't be honored ๐ฌ. That may not be apparent to the server until the recipient addresses are presented with RCPT TO commands, or until the message data finishes transferring with the dot (.) command ๐ฐ๏ธ. So the server may send the client a success response to the MAIL FROM command, and only later return an error response to the RCPT TO, DATA, or dot command ๐ญ.
4. The extended MAIL FROM command ๐
The extended MAIL FROM command is issued by an SMTP client when it wants to tell an SMTP server that a message needs to be delivered within a specified period of time, plus what action to take if the message turns out to be undeliverable in that window ๐ฏ. It's identical to the MAIL FROM command defined in RFC 821 [1], except that a BY parameter appears after the address โจ.
The complete syntax of this extended command is defined in [4] ๐. The esmtp-keyword is "BY", and the esmtp-value follows the syntax for by-value shown below. In the augmented BNF of RFC 2234 [2], the syntax for the BY esmtp-parameter is:
by-parameter = "BY="by-value
by-value = by-time";"by-mode[by-trace]
by-time = ["-" / "+"]1*9digit ; a negative or zero value is not
; allowed with a by-mode of "R"
by-mode = "N" / "R" ; "Notify" or "Return"
by-trace = "T" ; "Trace"
Note that the BY esmtp-keyword MUST have an associated esmtp-value ๐.
The by-time is a decimal representation of the number of seconds within which the message should be delivered, and it has this range:
-999,999,999 seconds <= by-time <= +999,999,999 seconds
That's enough to represent a time from roughly 31.6 years in the past to 31.6 years in the future โณ.
As described in Section 4.1, the by-mode tells the SMTP server what action it must take if it can't transmit the message within by-time seconds ๐ฌ.
Note that by-time is a delta time ๐บ: the number of seconds within which to deliver the message. This delta time doesn't extend an MTA's normal retention period for undeliverable messages, and it isn't a "deliver after" time ๐ .
A delta time is used to avoid problems caused by differences in system clocks between clients and servers ๐. Servers that receive a valid by-parameter are expected to convert the by-time into a locale-specific absolute time called the deliver-by-time ๐.
They do this by adding the by-time, upon receipt, to the current locale-specific time. That gives a locale-specific absolute time which is by-time seconds in the future or past, depending on the arithmetic sign of by-time โโ. The message is then to be delivered by the deliver-by-time โฐ. The sending client and receiving server should assume the transmission time of the MAIL FROM command to be instantaneous ๐๏ธ. Clearly it won't be, and network latency will introduce an error, which slightly extends the effective by-time ๐. The more hops the message takes, the more pronounced the effect, because this latency-induced error keeps accumulating ๐.
In the case of a by-mode of "N", by-time may be zero or negative. That's not an error and shouldn't be rejected as one ๐
. It indicates a message whose deliver-by-time occurred -(by-time) seconds in the past โช. [Here, "-(by-time)" represents the arithmetic negation of the by-time value.] Zero and negative values are allowed so that information about the requested delivery time is preserved ๐. The delivering MTA may want to include that information with the delivered message for the benefit of the recipient, or show it in a DSN or NDN (non delivery notification) ๐.
In the case of a by-mode of "R", a zero or negative by-time is a syntax error ๐. In such a case, the SMTP server SHOULD return a permanent failure (501) SMTP reply code in response to the extended MAIL FROM command ๐ซ. If the SMTP server also supports enhanced error codes [8], then an enhanced error code of 5.5.4 SHOULD also be returned ๐ข.
If the by-time is a valid by-time specification but the SMTP server cannot honor or accept it for a server-specific reason, then the SMTP server SHOULD respond with either a 455 SMTP response if the condition is transient or a 555 SMTP response if the condition is permanent ๐. In addition, if the SMTP server also supports [8], a suitable 4.X.X or 5.X.X enhanced error code SHOULD also be returned ๐ซถ.
4.1. Server behavior upon receipt of the extended MAIL FROM command โจ
okay so when a server gets an extended MAIL FROM with a valid BY parameter, the SMTP server and its MTA must handle the message following the subsections below, Sections 4.1.1-4.1.5 ๐ DSNs made for a Deliver By request should include both the optional Arrival-Date DSN field and the new Deliver-By-Date DSN field from Section 5 of this memo ๐ฌ
Note that a message's by-time does not extend the MTA's normal message retention period: an MTA MAY return a message as undeliverable before the deliver-by-time has been reached โณ
4.1.1. Successful delivery ๐
If the message is delivered before deliver-by-time, no special action need be taken โจ If the SMTP server or MTA also supports the Delivery Status Notification SMTP service extension [5] and a NOTIFY parameter including "SUCCESS" was specified, a "delivered" DSN with appropriate status must be returned as per [5] ๐
4.1.2. Unsuccessful delivery; deliver-by-time not yet reached ๐ธ
If deliver-by-time has not yet passed and the message has proved undeliverable for temporary reasons, then the SMTP server or MTA should continue delivery or relay attempts as per the site's message handling policy ๐ If the MTA's message retention period is less than by-time, the MTA MAY return the message as undeliverable before deliver-by-time has been reached. However, the message MUST still be handled in accord with Sections 4.1.1-4.1.5 ๐ซถ
If deliver-by-time has not yet passed and the message cannot be delivered for permanent reasons, then the SMTP server or MTA MUST return a "failed" DSN with an appropriate status for each recipient address with either no NOTIFY parameter specified or for which the NOTIFY parameter includes "FAILURE" ๐
4.1.3. Time has expired; deliver-by-time reached or passed โฐ
If the message is not delivered or relayed before deliver-by-time and a by-mode of "R" was specified, no further delivery attempts may be made for the message ๐ โโ๏ธ The server or MTA MUST issue a "failed" DSN with status 5.4.7, "delivery time expired", for each recipient address with either no NOTIFY parameter specified or for which the NOTIFY parameter includes "FAILURE" ๐ญ
If the message is not delivered or relayed before deliver-by-time and a by-mode of "N" was specified, the server or MTA should continue attempts to deliver or relay the message using the site's message handling policy ๐ In addition, the server or MTA MUST issue a "delayed" DSN with status 4.4.7, "delivery time expired", for each recipient address with either no NOTIFY parameter specified or for which the NOTIFY parameter includes "DELAY" ๐ง
4.1.4. Relaying to another SMTP server ๐ฆ
Sections 4.1.4.1 and 4.1.4.2 below describe when a message with a Deliver By request may be relayed to another SMTP server and what additional actions, if any, should or must be taken ๐บ๏ธ In addition to that discussed in those sections, the following must also be observed when relaying is permitted.
If the message is relayed to a SMTP server that supports the Deliver By extension, a new BY parameter MUST be relayed specifying a by-time value indicating the number of seconds remaining until deliver-by-time โฑ๏ธ The new by-time value should be computed as close to the time the MAIL FROM command is transmitted by the relaying SMTP client as is reasonably possible. Note that if deliver-by-time has passed, the relayed by-time will be a negative value indicating how many seconds have elapsed since deliver-by-time. Such a case -- relay of a message for which deliver-by-time has just arrived or passed -- may only happen with a message that has a by-mode of "N" ๐ค
When a message with a by-trace field with value "T" is relayed, a "relayed" DSN SHOULD be generated by the relaying SMTP client for each recipient which either did not specify a NOTIFY parameter or the NOTIFY parameter does not have the value "NEVER" ๐
Note that these "relayed" DSNs are generated regardless of whether success notifications were explicitly requested with a NOTIFY=SUCCESS parameter โจ Note further that the "relayed" DSNs discussed here are not terminal notifications: downstream SMTP servers and MTAs may still support [5] and as such additional notifications may still result ๐
4.1.4.1. Relaying a message with a by-mode of "R" ๐ซ
A message for which a by-mode of "R" was specified MUST NOT be relayed to a SMTP server which does not support the Deliver By SMTP service extension. Moreover, the server to which it is relayed MUST NOT have a fixed minimum by-time which is greater than the time remaining in which the message is to be delivered. The fixed minimum by-time is expressed by the optional deliverby-param discussed in Section 2 ๐
โโ๏ธ
If the message requires relaying in order to be delivered yet cannot be relayed, then the message is deemed to be undeliverable for permanent reasons and Section 4.1.2 should be applied ๐
4.1.4.2. Relaying a message with a by-mode of "N" ๐ท
A message with a by-mode of "N" may be relayed to another server regardless of whether or not the SMTP server to which it is relayed supports the Deliver By extension ๐ฅฐ
If the message is relayed before deliver-by-time to a SMTP server that does not support the Deliver By extension, then the relaying SMTP client MUST issue a "relayed" DSN for each recipient which either did not specify a NOTIFY parameter or the NOTIFY parameter does not have the value "NEVER". Further, if the SMTP server being relayed to supports the Delivery Status Notification SMTP service extension [5] then for each recipient: if no NOTIFY parameter was supplied, NOTIFY=FAILURE,DELAY SHOULD be requested; if a NOTIFY parameter was specified and does not have the value "NEVER", "DELAY" SHOULD be added to the list of notify-list-element values if not already present. Note that this explicitly overrides the "MUST NOT" wording of Section 6.2.1(c) of [5] ๐
4.1.5. Relaying to a foreign mail system ๐
If the foreign mail system supports semantics similar to the Deliver By SMTP service extension described in this memo, then convey the Deliver By request to that system. Otherwise, relay the message as if relaying to a SMTP server which does not support the Deliver By extension ๐ธ
5. Delivery status notifications and extension ๐ฌ
The format of delivery status notifications (DSNs) is specified in [6] ๐ DSNs generated in response to a Deliver By request should include an Arrival-Date DSN field. This memo also extends the per-message-fields of [6] to include a new DSN field, Deliver-By-Date, indicating the deliver-by-time as computed by the MTA or SMTP server generating the DSN. In the augmented BNF of RFC 822 [2], per-message-fields is therefore extended as follows:
per-message-fields =
[ original-envelope-id-field CRLF ]
reporting-mta-field CRLF
[ dsn-gateway-field CRLF ]
[ received-from-mta-field CRLF ]
[ arrival-date-field CRLF ]
[ deliver-by-date-field CRLF ]
*( extension-field CRLF )
deliver-by-date-field = "Deliver-by-date" ":" date-time
where date-time is a RFC 822 [2] date-time field as amended by RFC 1123 [3] ๐ง
6. Examples ๐
In the following sample SMTP dialog, the SMTP client requests that a message from <eljefe@bigbiz.com> be delivered to <topbanana@other.com> within 2 minutes (120 seconds) and returned otherwise. This request takes the form of a BY parameter on the MAIL FROM line of "BY=120;R" as shown below ๐
S: 220 acme.net SMTP server here
C: EHLO bigbiz.com
S: 250-acme.net
S: 250 DELIVERBY
C: MAIL FROM:<eljefe@bigbiz.com> BY=120;R
S: 250 <eljefe@bigbiz.com> sender ok
C: RCPT TO:<topbanana@other.com>
S: 250 <topbanana@wherever.com> recipient ok
Suppose now that the receiving SMTP server in the above example needs to relay the message to another SMTP server, mail.other.com. Owing to the original by-mode of "R", the message may only be relayed to another SMTP server which supports the Deliver By extension (Section 4.1.4). Further, when relaying the message, the Deliver By request must be relayed. With this in mind, consider the following SMTP dialog ๐ง
S: 220 mail.other.com ESMTP server at your service
C: EHLO acme.net
S: 250-mail.other.com
S: 250 DELIVERBY 240
C: QUIT
In the above dialog, the relaying SMTP server, acme.net, connects to mail.other.com and issues an EHLO command. It then learns that the Deliver By extension is supported but that the minimum by-time for a by-mode of "R" is 4 minutes (240 seconds). This value exceeds the message's original by-time and therefore necessarily exceeds the remaining by-time. The relaying SMTP server thus ends the SMTP session after which it must either attempt to follow any other MX records or, if there are no more MX records to follow, must return the message as undeliverable. Similar behavior would result if the EHLO command was met with an error or did not include the DELIVERBY keyword ๐
Consider instead, the relaying SMTP session ๐
S: 220 mail.other.com ESMTP server at your service
C: EHLO acme.net
S: 250-mail.other.com
S: 250 DELIVERBY 30
C: MAIL FROM:<eljefe@bigbiz.com> BY=98;R
S: 250 <eljefe@bigbiz.com> Sender okay
C: RCPT TO:<topbanana@other.com>
S: 250 <topbanana@wherever.com> Recipient okay
In the above, the relaying SMTP client relays the BY parameter with the by-mode preserved and the by-time computed to be the remaining number of seconds at the approximate time that the MAIL FROM command was transmitted from the relaying SMTP client (acme.net) to the receiving SMTP server (mail.other.com). In this example, 22 seconds have elapsed since acme.net received the MAIL FROM line from the original sending client and relayed the Deliver By request to mail.other.com โณโจ
7. MX based relaying considerations ๐ฎ
Sites which wish to use the Deliver By SMTP service extension and which direct their mail via MX records [9] need to ensure that all of their MX hosts -- hosts to which their mail is directed by MX records -- support the Deliver By extension. SMTP clients which support Deliver By SHOULD NOT attempt multiple MX hosts looking for one which supports Deliver By ๐
MX hosts should pay careful attention to the min-by-time value they present in response to EHLO commands. It is not practical for an MX host to present a value which either (1) is substantially different from that which can be handled by the destination host to which it relays, or (2) doesn't recognize normal delivery latencies introduced when the MX host relays mail to the destination host ๐ซ
8. Security Considerations ๐จ
Okay bestie, this one is SERIOUS ๐ญ Implementation of Deliver By allows tracing of a mail transport system. The by-trace field "T" explicitly requests that a trace be generated. Moreover, even when the by-trace field is not used, a crude trace may be generated by entering a series of messages into the transport system, each with successively increasing by-time values; e.g., "BY=0;R", "BY=1;R", "BY=2;R". Probing, and in some cases tracing, can be accomplished through other means: querying the visible SMTP servers, investigating Received: header lines in bounced messages, and using utilities such as "traceroute" ๐ต๏ธโโ๏ธ๐
9. Other Considerations ๐
okay bestie, so SMTP servers that support the Deliver By SMTP service extension, plus their MTAs, are not required to give Deliver By messages any special processing priority ๐ they totally can if they want to, though! ๐ but you should not, in general, expect expedited processing just because you asked for it. ๐ซถ
the DSN thing is the tea too โ sending a message with BY=60;R does NOT guarantee you'll hear about a delivery failure within that time window, because the DSN won't necessarily be expedited back to the sender. ๐ญ no cap, that's a lot of wiggle room. DSN processing for Deliver By messages is not required to be special either, so keep that in mind ๐
10. Acknowledgments ๐
the author wants to thank Keith Moore ๐ธ he's the one who gave this whole doc its initial push and the basic ideas inside it. โจ big thanks also to Ned Freed and Chris Newman for reviewing it and dropping suggestions for improvement. they're iconic for that ๐
11. References ๐
[1] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821, August 1982.
[2] Crocker, D., Editor, and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997.
[3] Braden, R., Editor, "Requirements for Internet Hosts -- Application and Support", STD 3, RFC 1123, October 1989.
[4] Rose, M., Stefferud, E., Crocker, D., Klensin, J. and N. Freed, "SMTP Service Extensions", STD 10, RFC 1869, November 1995.
[5] Moore, K., "SMTP Service Extension for Delivery Status Notifications", RFC 1891, January 1996.
[6] Moore, K. and G. Vaudreuil, "An Extensible Message Format for Delivery Status Notifications", RFC 1894, January 1996.
[7] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[8] Freed, N., "SMTP Service Extension for Returning Enhanced Error Codes", RFC 2034, October 1996.
[9] Partridge, C., "Mail Routing and the Domain System", STD 14, RFC 974, January 1986.
12. Author's Address ๐ง
Dan Newman
Sun Microsystems, Inc.
1050 Lakes Drive, Suite 250
West Covina, CA 91790
USA
Phone: +1 626 919 3600
Fax: +1 626 919 3614
EMail: dan.newman@sun.com
13. Full Copyright Statement ๐ฆ
the legal bit, kept word for word so nothing gets lost in translation ๐ซถ
Copyright (C) The Internet Society (2000). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement โจ
funding for the RFC Editor function is currently provided by the Internet Society. ๐ that's the whole doc, babe! ๐
๐ฆ where this page comes from
- ietf: rfc2852 2000-06
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms