RFC 1891

SMTP Service Extension for Delivery Status Notifications

๐Ÿ“… published January 1996, from ietf

RFC 1891: SMTP Service Extension for Delivery Status Notifications ๐Ÿ’Œ

Okay bestie, this is RFC 1891 ๐ŸŽ€. It's from the Network Working Group, written by K. Moore at the University of Tennessee, and it's a Standards Track document dated January 1996 ๐Ÿ’…. The header doesn't list any documents this one obsoletes or updates, so there's nothing it replaces or patches according to the header.


Status of This Memo โœจ

This document specifies an Internet standards track protocol for the whole Internet community ๐ŸŒ, and it's literally asking for discussion and suggestions to make it better ๐Ÿซถ. For the standardization state and status of this protocol, check the current edition of "Internet Official Protocol Standards" (STD 1) ๐Ÿ“š. Distribution of this memo is unlimited ๐Ÿฆ‹.

1. Abstract ๐ŸŒธ

This memo adds an extension to the SMTP service ๐Ÿ’Œ. It lets an SMTP client specify:

  • (a) when delivery status notifications (DSNs) should be generated under certain conditions,
  • (b) whether those notifications should return the contents of the message, and
  • (c) extra information, sent back with a DSN, that lets the sender identify both the recipient(s) the DSN was issued for and the transaction the original message was sent in ๐Ÿ•ต๏ธ.

Any questions, comments, and reports of defects or ambiguities in this specification can go to the mailing list for the NOTARY working group of the IETF, at <notifications@cs.utk.edu> ๐Ÿ“ฎ. To subscribe to that list, write to <notifications-request@cs.utk.edu> ๐Ÿ’œ. Implementors of this specification are encouraged to subscribe, so they'll hear right away about any problems that could get in the way of interoperability ๐Ÿ”ฅ.

NOTE: This document is a Proposed Standard ๐Ÿง. If and when this protocol is submitted for Draft Standard status, any normative text (the phrases with SHOULD, SHOULD NOT, MUST, MUST NOT, or MAY in them) will be re-evaluated in light of implementation experience, so it's subject to change ๐Ÿ‘€.

2. Introduction ๐ŸŽ€

Here's the deal: the SMTP protocol [1] requires that an SMTP server give notification of delivery failure whenever it decides a message can't be delivered to one or more recipients ๐Ÿ˜ญ. Traditionally, that notification is an ordinary Internet mail message (format defined by [2]). It gets sent to the envelope sender address (the argument of the SMTP MAIL command), and it has an explanation of the error plus at least the headers of the failed message ๐Ÿ’Œ.

Experience with large mail distribution lists [3] shows these messages are often not enough to diagnose problems, or even to figure out which host, or which recipients, a problem happened at ๐Ÿ’€. On top of that, Internet mail has no standardized format for delivery notifications, which makes it hard to swap them with other message handling systems ๐Ÿ™ˆ.

That experience showed we need a delivery status notification service for Internet email that:

  • (a) is reliable, meaning any DSN request will either be honored at the time of final delivery, or get a response saying the request can't be honored โœ….
  • (b) when both success and failure notifications are requested, gives an unambiguous, nonconflicting indication of whether delivery of a message to a recipient succeeded or failed ๐ŸŽฏ.
  • (c) is stable, meaning a failed attempt to deliver a DSN should never result in another DSN being transmitted over the network ๐Ÿ›‘.
  • (d) preserves enough information for the sender to identify both the mail transaction and the recipient address that caused the notification, even when mail is forwarded or gatewayed to foreign environments ๐Ÿ”.
  • (e) works acceptably with non-SMTP and non-822-based mail systems, so notifications returned from foreign mail systems can be useful to Internet users, and notification requests from foreign environments can be honored ๐ŸŒˆ. Among the requirements implied by this goal are the ability to request non-return-of-content, and the ability to specify whether positive delivery notifications, negative delivery notifications, both, or neither, should be issued ๐Ÿ’….

To provide that service, this memo uses the mechanism defined in [4] to define an extension to the SMTP protocol. With this mechanism, an SMTP client can ask an SMTP server to issue or not issue a delivery status notification (DSN) under certain conditions. The format of a DSN is defined in [5] โœจ.

3. Framework for the Delivery Status Notification Extension ๐Ÿฆ‹

So here's the service extension being defined:

  • (1) The name of the SMTP service extension is "Delivery Status Notification" ๐Ÿท๏ธ.
  • (2) The EHLO keyword value associated with this extension is "DSN", and its meaning is defined in section 4 of this memo ๐Ÿ”‘.
  • (3) No parameters are allowed with this EHLO keyword value ๐Ÿšซ.
  • (4) Two optional parameters are added to the RCPT command, and two optional parameters are added to the MAIL command:
    • An optional parameter for the RCPT command, using the esmtp-keyword "NOTIFY" (to specify the conditions under which a delivery status notification should be generated), is defined in section 5.1 ๐Ÿ””.
    • An optional parameter for the RCPT command, using the esmtp-keyword "ORCPT" (used to convey the "original" (sender-specified) recipient address), is defined in section 5.2 ๐Ÿ“ฌ.
    • An optional parameter for the MAIL command, using the esmtp-keyword "RET" (to request that DSNs containing an indication of delivery failure either return the entire contents of a message or only the message headers), is defined in section 5.3 ๐Ÿ“„.
    • An optional parameter for the MAIL command, using the esmtp-keyword "ENVID" (used to propagate an identifier for this message transmission envelope, which is also known to the sender and will, if present, be returned in any DSNs issued for this transmission), is defined in section 5.4 ๐Ÿ†”.
  • (5) No additional SMTP verbs are defined by this extension ๐Ÿ™….

The rest of this memo explains how support for the extension affects the behavior of a message transfer agent ๐Ÿงš.

4. The Delivery Status Notification service extension ๐Ÿ’…

An SMTP client that wants a DSN for a message can send the EHLO command to start an SMTP session, which lets it check whether the server supports any of several service extensions ๐Ÿ”. If the server responds to EHLO with code 250, and the response includes the EHLO keyword DSN, then the Delivery Status Notification extension (as described in this memo) is supported ๐Ÿฅณ.

Normally, when an SMTP server returns a positive (2xx) reply code in response to a RCPT command, it agrees to take responsibility for either delivering the message to the named recipient, or sending a notification to the sender saying delivery has failed ๐Ÿ’Œ. However, an extended SMTP ("ESMTP") server that implements this service extension will accept an optional NOTIFY parameter with the RCPT command ๐ŸŽ€. If it's present, the NOTIFY parameter changes the conditions for generating delivery status notifications from the default specified in [1] (issue notifications only on failure). The ESMTP client can also use the RET parameter to request whether the entire contents of the original message should come back with the DSN, as opposed to just its headers ๐Ÿ’œ.

In general, an ESMTP server that implements this extension will propagate delivery status notification requests when relaying mail to other SMTP-based MTAs that also support this extension. It will also make a "best effort" to make sure those requests are honored when messages are passed into other environments ๐ŸŒธ.

So that the notifications generated this way actually mean something to the sender, any ESMTP server that supports this extension will try to propagate the following information to any other MTAs used to relay the message, for use in generating DSNs ๐Ÿ•ต๏ธ:

  • (a) For each recipient, a copy of the original recipient address, as used by the sender of the message.

This address need not be the same as the mailbox specified in the RCPT command. For example, if a message was originally addressed to A@B.C and later forwarded to A@D.E, then after forwarding has taken place, the RCPT command will specify a mailbox of A@D.E. However, the original recipient address remains A@B.C ๐Ÿฆ‹.

Also, if the message originated from an environment that doesn't use Internet-style user@domain addresses, and was gatewayed into SMTP, the original recipient address will preserve the original form of the recipient address ๐Ÿง.

  • (b) For the entire SMTP transaction, an envelope identification string, which the sender can use to associate any delivery status notifications with the transaction used to send the original message ๐Ÿ”—.

5. Additional parameters for RCPT and MAIL commands ๐ŸŽ€

The extended RCPT and MAIL commands are issued by a client when it wants a DSN from the server, under certain conditions, for a particular recipient ๐Ÿ’…. They're identical to the RCPT and MAIL commands defined in [1], except that one or more of the following parameters appear after the sender or recipient address, respectively. The general syntax for extended SMTP commands is defined in [4] โœจ.

NOTE: Although RFC 822 ABNF is used to describe the syntax of these parameters, they are not, in the language of that document, "structured field bodies". Therefore, while parentheses MAY appear within an emstp-value, they are not recognized as comment delimiters โš ๏ธ.

The syntax for "esmtp-value" in [4] doesn't allow SP, "=", control characters, or characters outside the traditional ASCII range of 1-127 decimal to be transmitted in an esmtp-value. Because the ENVID and ORCPT parameters may need to convey values outside that range, their esmtp-values are encoded as "xtext". Here's the formal definition of "xtext" ๐Ÿงฉ:

     xtext = *( xchar / hexchar )

     xchar = any ASCII CHAR between "!" (33) and "~" (126) inclusive,
          except for "+" and "=".

; "hexchar"s are intended to encode octets that cannot appear
; as ASCII characters within an esmtp-value.

     hexchar = ASCII "+" immediately followed by two upper case
          hexadecimal digits

When encoding an octet sequence as xtext:

  • Any ASCII CHAR between "!" and "~" inclusive, except for "+" and "=", MAY be encoded as itself. (A CHAR in this range MAY instead be encoded as a "hexchar", at the implementor's discretion.) ๐ŸŒท
  • ASCII CHARs that fall outside the range above must be encoded as "hexchar" ๐Ÿ”ฅ.

5.1. The NOTIFY parameter of the ESMTP RCPT command ๐Ÿ””

A RCPT command issued by a client may contain the optional esmtp-keyword "NOTIFY", which sets the conditions under which the SMTP server should generate DSNs for that recipient ๐Ÿ’œ. If the NOTIFY esmtp-keyword is used, it MUST have an associated esmtp-value, formatted according to the following rules, using the ABNF of RFC 822:

     notify-esmtp-value = "NEVER" / 1#notify-list-element

     notify-list-element = "SUCCESS" / "FAILURE" / "DELAY"

Notes:

  • a. Multiple notify-list-elements, separated by commas, MAY appear in a NOTIFY parameter; however, the NEVER keyword MUST appear by itself ๐Ÿง.
  • b. Any of the keywords NEVER, SUCCESS, FAILURE, or DELAY may be spelled in any combination of upper and lower case letters ๐ŸŒˆ.

The meaning of the NOTIFY parameter values is generally as follows:

  • A NOTIFY parameter value of "NEVER" requests that a DSN not be returned to the sender under any conditions ๐Ÿ™…โ€โ™€๏ธ.
  • okay so a NOTIFY value with "SUCCESS" or "FAILURE" in it is asking for a DSN ๐Ÿ“ฌ on successful delivery or on delivery failure, respectively ๐Ÿ’–
  • a NOTIFY value with the keyword DELAY in it means the sender is cool with getting "delayed" DSNs ๐Ÿ•ฐ๏ธ these can show up if a message has been sitting around for an unusually long time (the MTA where it's stuck gets to decide what "unusually" means ๐Ÿ™ˆ), but the final outcome, success or failure, still can't be figured out yet. no DELAY keyword in the NOTIFY parameter means a "delayed" DSN NOT be issued under any conditions ๐Ÿšซ

The actual rules for how the NOTIFY parameter gets interpreted are in section 6, so stay tuned โœจ

For compatibility with SMTP clients that don't use the NOTIFY facility, a RCPT command with no NOTIFY parameter at all may be read as either NOTIFY=FAILURE or NOTIFY=FAILURE,DELAY ๐Ÿซถ


5.2. The ORCPT parameter to the ESMTP RCPT command โœจ

okay bestie, ORCPT is the "original" recipient address ๐ŸŽ€ the one that points at the actual recipient the message is going to be delivered to. if you use ORCPT, it MUST have an esmtp-value attached, and that value is the original recipient address encoded using the rules below ๐Ÿ’… the ABNF looks like this:

orcpt-parameter = "ORCPT=" original-recipient-address

original-recipient-address = addr-type ";" xtext

addr-type = atom

the addr-type part MUST be an IANA-registered electronic mail address-type (as defined in [5]), and the xtext part holds the encoded version of the original recipient address, using the rules in section 5 of this document ๐Ÿฆ‹ the whole ORCPT parameter MAY be up to 500 characters long ๐Ÿ’œ

when you first submit a message over SMTP and use ORCPT, it MUST contain the same address as the RCPT TO address (the difference is that ORCPT gets encoded as xtext, but it's still the same address ๐ŸŒธ). same thing for a mailing list that submits a message over SMTP to go out to its subscribers: if ORCPT is used, it MUST match the new RCPT TO address of each recipient, NOT the address the original sender wrote ๐Ÿ‘‘ (yes, there's a stray closing paren in the original, we love a little typo ๐Ÿ™ˆ)

the addr-type part just tells you what type of address is in the ORCPT value. but the address that goes with the ORCPT keyword is NOT forced to follow the syntax rules for that addr-type ๐Ÿงš

ideally, the xtext part should hold, in encoded form, the same characters the sender used to specify the recipient โœจ but if a message got gatewayed from an environment like X.400, where a recipient address isn't just a simple string of printable characters, the way the recipient address gets represented must be defined by a spec for gatewaying between DSNs and that environment ๐Ÿ’–


5.3. The RET parameter of the ESMTP MAIL command โœจ

the RET esmtp-keyword on the extended MAIL command decides whether or not the message gets included in any failed DSN issued for this message transmission ๐Ÿ“ if RET is used, it MUST have an associated esmtp-value, and that value is one of these keywords:

  • FULL requests that the entire message be returned in any "failed" delivery status notification issued for this recipient ๐ŸŒˆ
  • HDRS requests that only the headers of the message be returned ๐Ÿฆ‹

FULL and HDRS can be spelled in any combo of upper and lower case letters, so do whatever vibes with you ๐Ÿ’…

if no RET parameter is supplied, the MTA MAY return either the headers of the message or the entire message for any DSN that has failed deliveries in it ๐ŸŽ€

ngl, the RET parameter only applies to DSNs that show a delivery failure for at least one recipient ๐Ÿ’€ if a DSN has no delivery failures in it, only the headers of the message should be returned ๐ŸŒธ


5.4. The ENVID parameter to the ESMTP MAIL command โœจ

the ENVID esmtp-keyword on the SMTP MAIL command is used to specify an "envelope identifier" ๐Ÿงš it gets sent along with the message and shows up in any DSNs issued for any of the recipients in this SMTP transaction. the whole point is that the sender can use it to figure out which transaction a DSN belongs to ๐Ÿซถ

the ABNF is:

envid-parameter = "ENVID=" xtext

the ENVID esmtp-keyword MUST have an associated esmtp-value ๐Ÿ’œ the mail system doesn't assign any meaning to whether this parameter is there or not, or to its value. the info is only for the sender or their user agent, so it's their business only ๐Ÿ™ˆ the ENVID parameter MAY be up to 100 characters long โœจ


5.5. Restrictions on the use of Delivery Status Notification parameters ๐Ÿ’…

the RET and ENVID parameters MUST NOT appear more than once each in any single MAIL command ๐Ÿšซ if more than one of either one shows up in a MAIL command, the ESMTP server SHOULD respond with 501 syntax error in parameters or arguments ๐Ÿ˜ญ

the NOTIFY and ORCPT parameters MUST NOT appear more than once in any RCPT command ๐Ÿšซ if more than one of either one shows up in a RCPT command, the ESMTP server SHOULD respond with 501 syntax error in parameters or arguments ๐ŸŒˆ


6. Conformance requirements โœจ

SMTP (the Simple Mail Transfer Protocol) is used by Message Transfer Agents (MTAs) when they accept, relay, or gateway mail, and by User Agents (UAs) when they submit mail to the mail transport system ๐ŸŽ€ the DSN extension to SMTP may be used to let UAs pass along the sender's wishes about when DSNs should be issued ๐Ÿ’– a UA that claims to conform to this specification must meet certain requirements, which are described below ๐Ÿ‘‘

typically, an MTA that supports SMTP will play both the SMTP client role and the SMTP server role at different times ๐Ÿฆ‹ it may also do local delivery, gatewaying to foreign environments, forwarding, and mailing list expansion ๐ŸŒธ an MTA that issues the DSN keyword in response to the EHLO command, when it's acting as an SMTP server, MUST obey the rules below for a "conforming SMTP client" when it's acting as a client, and for a "conforming SMTP server" when it's acting as a server ๐Ÿ’… the term "conforming MTA" refers to an MTA that conforms to this specification, no matter whether it's acting as a client or a server ๐Ÿงš


6.1. SMTP protocol interactions ๐Ÿซถ

the following rules apply to SMTP transactions where any of the ENVID, NOTIFY, RET, or ORCPT keywords are used ๐Ÿ’œ

(a) if an SMTP client issues a MAIL command with a valid ENVID parameter and its associated esmtp-value, and/or a valid RET parameter and its associated esmtp-value, a conforming SMTP server MUST return the same reply-code it would send for the same MAIL command without the ENVID and/or RET parameters ๐ŸŒˆ a conforming SMTP server MUST NOT refuse a MAIL command based on whether valid ENVID or RET parameters are there or not, or based on their associated esmtp-values ๐Ÿ™…

however, if the associated esmtp-value isn't valid (i.e. it has illegal characters in it), or if there's more than one ENVID or RET parameter in a particular MAIL command, the server MUST issue the reply-code 501 with an appropriate message (e.g. "syntax error in parameter") ๐Ÿ˜ญ

(b) if an SMTP client issues a RCPT command with any valid NOTIFY and/or ORCPT parameters, a conforming SMTP server MUST return the same response it would give for the same RCPT command without those NOTIFY and/or ORCPT parameters ๐Ÿ“ a conforming SMTP server MUST NOT refuse a RCPT command based on whether any of these parameters are present or absent ๐Ÿซถ

however, if any of the associated esmtp-values are not valid, or if there's more than one of any of these parameters in a particular RCPT command, the server SHOULD issue the response 501 syntax error in parameter ๐Ÿ’…


6.2. Handling of messages received via SMTP ๐ŸŽ€

this section describes how a conforming MTA should handle any messages it receives via SMTP โœจ

NOTE: a DSN MUST NOT be returned to the sender for any message whose return address from the SMTP MAIL command was NULL (<>), even if the sender's address is available from other sources (e.g. the message header) ๐Ÿšซ however, the MTA that would otherwise issue a DSN SHOULD inform the local postmaster of delivery failures through some appropriate mechanism that won't itself result in DSNs being generated ๐Ÿ‘‘

DISCUSSION: RFC 1123, section 2.3.3 requires error notifications to be sent with a NULL return address ("reverse-path") ๐Ÿงš this creates a super interesting situation when a message arrives with one or more nonfunctional recipient addresses AND a nonfunctional return address ๐Ÿ˜ญ when delivery to one of the recipient addresses fails, the MTA will try to send a nondelivery notification to the return address, setting the return address on that notification to NULL ๐ŸŒธ when delivery of that notification fails, the MTA attempting it sees a NULL return address ๐Ÿ’€ if that MTA didn't tell anyone about the situation, the original message would be silently lost ๐Ÿ™ˆ plus, a nonfunctional return address is often a sign of a configuration problem in the sender's MTA ๐Ÿฆ‹ reporting it to the local postmaster may help speed up fixing these errors ๐Ÿ’–


6.2.1. Relay of messages to other conforming SMTP servers ๐Ÿฆ‹

the following rules govern how a conforming MTA behaves when it relays a message, which was received via the SMTP protocol, to an SMTP server that supports the Delivery Status Notification service extension ๐ŸŒˆ

(a) any ENVID parameter that was included in the MAIL command when the message was received MUST also appear on the MAIL command used to relay it, with the same associated esmtp-value ๐Ÿ’œ if no ENVID parameter was included in the MAIL command when the message was received, the ENVID parameter MUST NOT be supplied when the message is relayed ๐Ÿšซ

(b) any RET parameter that was included in the MAIL command when the message was received MUST also appear on the MAIL command used to relay it, with the same associated esmtp-value ๐ŸŽ€ if no RET parameter was included in the MAIL command when the message was received, the RET parameter MUST NOT supplied when the message is relayed ๐Ÿ™…

(c) if the NOTIFY parameter was supplied for a recipient when the message was received, the RCPT command issued when the message is relayed MUST also contain the NOTIFY parameter along with its associated esmtp-value ๐Ÿซถ if the NOTIFY parameter was not supplied for a recipient when the message was received, the NOTIFY parameter MUST NOT be supplied for that recipient when the message is relayed โœจ

(d) okay so, if an ORCPT parameter was already on the RCPT command for a recipient when the message came in, then an ORCPT parameter with the identical original-recipient-address MUST appear in the RCPT command you send for that recipient when relaying. ๐Ÿ’– For example, the MTA therefore MUST NOT change the case of any alphabetic characters in an ORCPT parameter. No sneaky capitalization, bestie ๐Ÿ™…โ€โ™€๏ธโœจ

If there was no ORCPT parameter on the RCPT command when the message was received, an ORCPT parameter MAY be added when the message is relayed. ๐Ÿฆ‹ And if the relaying MTA does add one, it MUST contain the recipient address from the RCPT command that was used when the message was received by that MTA. ๐Ÿซถ

6.2.2. Relay of messages to non-conforming SMTP servers ๐ŸŒธ

Okay, here's the rulebook for a conforming MTA acting as the client, when it relays a message that came in over SMTP to an SMTP server that does not support the Delivery Status Notification service extension. ๐Ÿ“ฎ

(a) ENVID, NOTIFY, RET, or ORCPT parameters MUST NOT be issued when relaying the message. ๐Ÿ™…โ€โ™€๏ธ

(b) If the NOTIFY parameter was supplied for a recipient, with an esmtp-value containing the keyword SUCCESS, and the SMTP server returns a success (2xx) reply-code in response to the RCPT command, the client MUST issue a "relayed" DSN for that recipient. ๐Ÿ’…

(c) If the NOTIFY parameter was supplied for a recipient with an esmtp-value containing the keyword FAILURE, and the SMTP server returns a permanent failure (5xx) reply-code in response to the RCPT command, the client MUST issue a "failed" DSN for that recipient. ๐Ÿ’€

(d) If the NOTIFY parameter was supplied for a recipient with an esmtp-value of NEVER, the client MUST NOT issue a DSN for that recipient, regardless of the reply-code returned by the SMTP server. However, if the server returned a failure (5xx) reply-code, the client MAY inform the local postmaster of the delivery failure via an appropriate mechanism that will not itself result in the generation of DSNs. ๐Ÿคซ

When attempting to relay a message to an SMTP server that does not support this extension, and if NOTIFY=NEVER was specified for some recipients of that message, a conforming SMTP client MAY relay the message for those recipients in a separate SMTP transaction, using an empty reverse-path in the MAIL command. This will prevent DSNs from being issued for those recipients by MTAs that conform to [1]. ๐Ÿงš

(e) If a NOTIFY parameter was not supplied for a recipient, and the SMTP server returns a success (2xx) reply-code in response to a RCPT command, the client MUST NOT issue any DSN for that recipient. ๐Ÿค

(f) If a NOTIFY parameter was not supplied for a recipient, and the SMTP server returns a permanent failure (5xx) reply-code in response to a RCPT command, the client MUST issue a "failed" DSN for that recipient. ๐Ÿ”ฅ

6.2.3. Local delivery of messages ๐ŸŽ€

The rules here are for a conforming MTA that has successfully delivered a message received over SMTP to a local recipient's mailbox. ๐Ÿ’Œ

"Delivery" means that the message has been placed in the recipient's mailbox. For messages that get sent to a mailbox for later retrieval via IMAP [6], POP [7] or a similar message access protocol, "delivery" happens when the message is made available to the IMAP (POP, etc.) service, not when the recipient's user agent actually retrieves it. โœจ

Similarly, for a recipient address that corresponds to a mailing list exploder, "delivery" happens when the message is made available to that list exploder, even if the list exploder might refuse to deliver that message to the list recipients. ๐Ÿ™ƒ

(a) If the NOTIFY parameter was supplied for that recipient, with an esmtp-value containing the SUCCESS keyword, the MTA MUST issue a "delivered" DSN for that recipient. ๐ŸŽ‰

(b) If the NOTIFY parameter was supplied for that recipient but did not contain the SUCCESS keyword, the MTA MUST NOT issue a DSN for that recipient. ๐Ÿคซ

(c) If the NOTIFY parameter was not supplied for that recipient, the MTA MUST NOT issue a DSN. ๐Ÿ™…โ€โ™€๏ธ

6.2.4. Gatewaying a message into a foreign environment ๐ŸŒˆ

Here's how a conforming MTA handles a message that came in over SMTP when it gets gatewayed into a foreign (non-SMTP) environment. ๐Ÿ›ธ

(a) If the foreign environment is capable of issuing appropriate notifications under the conditions requested by the NOTIFY parameter, and the conforming MTA can ensure that any notification thus issued will be translated into a DSN and delivered to the original sender, then the MTA SHOULD gateway the message into the foreign environment, requesting notification under the desired conditions, without itself issuing a DSN. ๐Ÿช„

(b) If a NOTIFY parameter was supplied with the SUCCESS keyword, but the destination environment cannot return an appropriate notification on successful delivery, the MTA SHOULD issue a "relayed" DSN for that recipient. ๐Ÿ’ซ

(c) If a NOTIFY parameter was supplied with an esmtp-keyword of NEVER, a DSN MUST NOT be issued. If possible, the MTA SHOULD direct the destination environment to not issue delivery notifications for that recipient. ๐ŸŒ™

(d) If the NOTIFY parameter was not supplied for a particular recipient, a DSN SHOULD NOT be issued by the gateway. The gateway SHOULD attempt to ensure that appropriate notification will be provided by the foreign mail environment if eventual delivery failure occurs, and that no notification will be issued on successful delivery. ๐Ÿซ 

(e) When gatewaying a message into a foreign environment, the return-of-content conditions specified by any RET parameter are nonbinding; however, the MTA SHOULD attempt to honor the request using whatever mechanisms exist in the foreign environment. ๐Ÿคž

6.2.5. Delays in delivery โฐ

If a conforming MTA receives a message via the SMTP protocol, and is unable to deliver or relay it to one or more recipients for an extended length of time (to be determined by the MTA), it MAY issue a "delayed" DSN for those recipients, subject to the following conditions: ๐Ÿข

(a) If the NOTIFY parameter was supplied for a recipient and its value included the DELAY keyword, a "delayed" DSN MAY be issued. ๐Ÿ•ฐ๏ธ

(b) If the NOTIFY parameter was not supplied for a recipient, a "delayed" DSN MAY be issued. ๐ŸŒค๏ธ

(c) If the NOTIFY parameter was supplied but did not contain the DELAY keyword, a "delayed" DSN MUST NOT be issued. ๐Ÿšซ

NOTE: Although delay notifications are common in present-day electronic mail, a conforming MTA is never required to issue "delayed" DSNs. The DELAY keyword of the NOTIFY parameter is provided to allow the SMTP client to specifically request (by omitting the DELAY parameter) that "delayed" DSNs NOT be issued. ๐Ÿ’…โœจ

6.2.6. Failure of a conforming MTA to deliver a message ๐Ÿ’”

This section covers a conforming MTA that received a message via SMTP and can't deliver it to a recipient named in the SMTP transaction. ๐Ÿ˜ฌ

(a) If a NOTIFY parameter was supplied for the recipient with an esmtp-keyword containing the value FAILURE, a "failed" DSN MUST be issued by the MTA. ๐Ÿšจ

(b) If a NOTIFY parameter was supplied for the recipient which did not contain the value FAILURE, a DSN MUST NOT be issued for that recipient. However, the MTA MAY inform the local postmaster of the delivery failure via some appropriate mechanism which does not itself result in the generation of DSNs. ๐Ÿ“ฃ

(c) If no NOTIFY parameter was supplied for the recipient, a "failed" DSN MUST be issued. ๐Ÿซก

NOTE: Some MTAs are known to forward undeliverable messages to the local postmaster or "dead letter" mailbox. This is still considered delivery failure, and does not diminish the requirement to issue a "failed" DSN under the conditions defined elsewhere in this memo. If a DSN is issued for such a recipient, the Action value MUST be "failed". ๐Ÿชฆ

6.2.7. Forwarding, aliases, and mailing lists ๐Ÿฆ‹

Delivering a message to a local email address usually means it gets stored in the recipient's mailbox. ๐Ÿ“ซ But MTAs commonly let a local address be designated as an "alias" or "mailing list," so delivery to that address then gets forwarded to each of the (local or remote) recipient addresses tied to the alias or list. It's also common for a user to optionally "forward" her mail to one or more alternate addresses. If that feature is enabled, her mail gets redistributed to those addresses instead of landing in her mailbox. ๐Ÿ“จ

Following the example of [9] (section 5.3.6), this document defines the difference between an "alias" and a "mailing list" like this: when forwarding a message to the addresses tied to an "alias", the envelope return address (e.g. SMTP MAIL FROM) stays intact. ๐Ÿงฉ But when forwarding a message to the addresses tied to a "mailing list", the envelope return address changes to that of the mailing list's administrator. This means DSNs and other nondelivery reports from delivery to the list members go to the list administrator, not to the sender of the original message. ๐Ÿ‘‘

The DSN processing for aliases and mailing lists goes like this:

6.2.7.1. mailing lists ๐Ÿ“ฌ

When a message is delivered to a list submission address (i.e. placed in the list's mailbox for incoming mail, or accepted by the process that redistributes the message to the list subscribers), that counts as final delivery for the original message. If the NOTIFY parameter for the list submission address contained the SUCCESS keyword, a "delivered" DSN MUST be returned to the sender of the original message. ๐ŸŽ€

NOTE: Some mailing lists can reject message submissions based on the content of the message, the sender's address, or some other criteria. While the interface between such a mailing list and its MTA is not well-defined, it is important that DSNs NOT be issued by both the MTA (to report successful delivery to the list), and the list (to report message rejection using a "failure" DSN.) ๐Ÿ™ˆ

However, even if a "delivered" DSN was issued by the MTA, a mailing list that rejects a message submission MAY notify the sender that the message was rejected using an ordinary message instead of a DSN. ๐Ÿ’Œ

Whenever a message is redistributed to a mailing list:

(a) The envelope return address is rewritten to point to the list maintainer. This address MAY be that of a process that recognizes DSNs and processes them automatically, but it MUST forward unrecognized messages to the human responsible for the list. ๐Ÿค–โžก๏ธ๐Ÿง‘

(b) The ENVID, NOTIFY, RET, and ORCPT parameters that accompany the redistributed message MUST NOT be derived from those of the original message. ๐Ÿ™…โ€โ™€๏ธ

(c) The NOTIFY and RET parameters MAY be specified by the local postmaster or the list administrator. If ORCPT parameters are supplied during redistribution to the list subscribers, they SHOULD contain the addresses of the list subscribers in the format used by the mailing list. ๐ŸŒท

6.2.7.2. single-recipient aliases ๐ŸŽฏ

Under normal circumstances, when a message arrives for an "alias" that has a single forwarding address, a DSN SHOULD NOT be issued. Any ENVID, NOTIFY, RET, or ORCPT parameters SHOULD be propagated with the message as it is redistributed to the forwarding address. ๐Ÿซถ

6.2.7.3. multiple-recipient aliases ๐ŸŒท

An "alias" with multiple recipient addresses may be handled in any of the following ways:

(a) okay bestie, so ENVID, NOTIFY, RET, and ORCPT parameters are NOT propagated when the message gets relayed to any of the forwarding addresses ๐Ÿ™…โ€โ™€๏ธ. If the NOTIFY parameter for the alias had the SUCCESS keyword, the MTA issues a "relayed" DSN ๐Ÿ“จ. (lowkey the MTA acts like it's relaying into a place that has zero DSN support at all ๐Ÿซ )

(b) the ENVID, NOTIFY, RET, or ORCPT parameters (or the equivalent requests if the message was gatewayed) get passed along to EXACTLY one of the forwarding addresses ๐ŸŽฏ, and no DSN is issued. this is the move when you alias a message to a "vacation" auto-responder and your regular mailbox ๐Ÿ–๏ธ

(c) any ENVID, RET, or ORCPT parameters get propagated to all forwarding addresses tied to that alias ๐Ÿ“ฌ. the NOTIFY parameter goes along too, except any SUCCESS keyword gets removed. if the original NOTIFY parameter for the alias had SUCCESS in it, an "expanded" DSN is issued for the alias ๐ŸŒธ. if the alias's NOTIFY parameter did NOT have SUCCESS, no DSN is issued for the alias ๐Ÿ™ˆ

6.2.7.4 confidential forwarding addresses

if you want to keep a recipient's forwarding address hush-hush ๐Ÿคซ, the forwarding can be treated like it's a mailing list. a DSN will be issued, if appropriate, upon "delivery" to the recipient address the sender specified. when the message gets forwarded it gets a brand new envelope return address ๐Ÿ’Œ. any DSNs that come from the forwarded message failing to deliver won't go back to the original sender, so the forwarding address stays unexposed ๐Ÿซฃ

6.2.8 DSNs describing delivery to multiple recipients

one DSN can describe delivery attempts to multiple recipients of the same message ๐Ÿ’–. if a DSN is issued for some recipients in an SMTP transaction but not others (per the rules above), the DSN SHOULD NOT contain info for the recipients who wouldn't have gotten a DSN anyway ๐Ÿ™…

6.3 Handling of messages from other sources

for messages that came from "local" users (whatever that means ๐Ÿ’€), the rules for generating DSNs can be shared with the MTA through any protocol the sender's mail composer (user agent) and the MTA agreed on ๐Ÿงš. the local MTA can then either relay the message, or send out the right delivery status notifications. BUT if those requests are sent inside the message itself (like in the message headers), the requests MUST be removed from the message before it gets sent over SMTP ๐Ÿšซ

for messages gatewayed from non-SMTP sources and then relayed by SMTP, the gateway SHOULD, using the SMTP extensions described here, try to provide the delivery reporting conditions the source mail environment expects ๐ŸŒˆ. if appropriate, any DSNs sent back to the source environment SHOULD be translated into the format that environment expects โœจ

6.4 Implementation limits

a conforming MTA MUST accept ESMTP parameters of at least these sizes:

(a) ENVID parameter: 100 characters.

(b) NOTIFY parameter: 28 characters.

(c) ORCPT parameter: 500 characters.

(d) RET parameter: 8 characters.

the max sizes for ENVID and ORCPT are meant to be big enough for "foreign" envelope identifiers and original recipient addresses ๐ŸŒ. however, user agents that use SMTP as a message submission protocol SHOULD NOT generate ENVID parameters longer than 38 characters ๐Ÿ™…โ€โ™€๏ธ

a conforming MTA MUST be able to accept SMTP command-lines that are at least 1036 characters long (530 characters for the ORCPT and NOTIFY parameters of the RCPT command, plus the 512 characters required by [1]) ๐Ÿ“. if the MTA supports other SMTP extensions, it MUST be able to accept a command-line big enough for each SMTP command and any combination of ESMTP parameters that might be used with that command ๐ŸŽ€

7. Format of delivery notifications ๐Ÿ’…

the format of delivery status notifications is defined in [5], which uses the framework defined in [8]. delivery status notifications get returned to the sender of the original message, as outlined below ๐Ÿ’Œ

7.1 SMTP Envelope to be used with delivery status notifications

the DSN sender address (in the SMTP MAIL command) MUST be a null reverse-path ("<>"), as required by section 5.3.3 of [9] ๐Ÿซถ. the DSN recipient address (in the RCPT command) gets copied from the MAIL command that came with the message the DSN is being issued for. when sending a DSN over SMTP, the RET parameter MUST NOT be used ๐Ÿšซ. the NOTIFY parameter MAY be used, but its value MUST be NEVER ๐Ÿ™ˆ. the ENVID parameter (with a newly generated envelope-id) and/or ORCPT parameter MAY be used ๐Ÿฆ‹

7.2 Contents of the DSN

a DSN is transmitted as a MIME message with a top-level content-type of multipart/report (as defined in [5]) ๐ŸŒธ

the multipart/report content-type may be used for any of several kinds of reports the mail system generates. when multipart/report is used to carry a DSN, the report-type parameter of the multipart/report content-type is "delivery-status" โœจ

as described in [8], the first component of a multipart/report content-type is a human readable explanation of the report. for a DSN, the second component of the multipart/report is of content-type message/delivery-status (defined in [5]). the third component of the multipart/report consists of the original message or some portion of it ๐Ÿ“ฎ. when the value of the RET parameter is FULL, the full message SHOULD be returned for any DSN that tells you about a delivery failure. (however, if the message is longer than some implementation-specified length, the MTA MAY return only the headers even if RET specified FULL) ๐Ÿงณ. if a DSN contains no notifications of delivery failure, the MTA SHOULD return only the headers ๐Ÿ™‚

the third component must have an appropriate content-type label. the issues around picking the content-type are discussed in [8] ๐Ÿ’œ

7.3 Message/delivery-status fields

the message/delivery-status content-type defines a bunch of fields, with general specs for what goes in them ๐Ÿ—‚๏ธ. the requirements below apply to any DSNs generated in response to a message a conforming SMTP server received over the SMTP protocol, and they're in addition to the requirements in [5] for the message/delivery-status type ๐Ÿซง

when generating a DSN for a message received via SMTP, a conforming MTA will generate the following fields of the message/delivery-status body part:

(a) if an ENVID parameter was present on the MAIL command, an Original-Envelope-ID field MUST be supplied, and the value associated with the ENVID parameter must appear in that field. if the message was received via SMTP with no ENVID parameter, the Original-Envelope-ID field MUST NOT be supplied ๐Ÿšซ

since the ENVID parameter is encoded as xtext, but the Original-Envelope-ID header is NOT encoded as xtext, the MTA must decode the xtext encoding when copying the ENVID value to the Original-Envelope-ID field ๐Ÿ”

(b) the Reporting-MTA field MUST be supplied. if the Reporting MTA can figure out its fully-qualified Internet domain name, the MTA-name-type subfield MUST be "dns", and the field MUST contain the fully-qualified domain name of the Reporting MTA ๐ŸŒ. if the fully-qualified Internet domain name of the Reporting MTA isn't known (for example, for an SMTP server that isn't directly connected to the Internet), the Reporting-MTA field may contain any string that identifies the MTA, but in that case the MTA-name-type subfield MUST NOT be "dns" ๐Ÿ . a MTA-name-type subfield value of "x-local-hostname" is suggested ๐Ÿ’ก

(c) other per-message fields defined in [5] MAY be supplied as appropriate ๐ŸŽ€

(d) if the ORCPT parameter was provided for this recipient, the Original-Recipient field MUST be supplied, with its value taken from the ORCPT parameter. if no ORCPT parameter was provided for this recipient, the Original-Recipient field MUST NOT appear ๐Ÿซฃ

(e) the Final-Recipient field MUST be supplied. it MUST contain the recipient address from the message envelope. if the message was received via SMTP, the address-type will be "rfc822" ๐Ÿ“ซ

(f) the Action field MUST be supplied ๐ŸŽฌ

(g) the Status field MUST be supplied, using a status-code from [10]. if there's no specific code that suitably describes a delivery failure, either 4.0.0 (temporary failure) or 5.0.0 (permanent failure) MUST be used ๐Ÿ”ข

(h) for DSNs resulting from attempts to relay a message to one or more recipients via SMTP, the Remote-MTA field MUST be supplied for each of those recipients. the mta-name-type subfields of those Remote-MTA fields will be "dns" ๐Ÿ›ฐ๏ธ

(i) for DSNs resulting from attempts to relay a message to one or more recipients via SMTP, the Diagnostic-Code MUST be supplied for each of those recipients. the diagnostic-type subfield will be "smtp". see section 9.2(a) of this document for a description of the "smtp" diagnostic-code ๐Ÿฉบ

(j) for DSNs resulting from attempts to relay a message to one or more recipients via SMTP, an SMTP-Remote-Recipient extension field MAY be supplied for each recipient, containing the address of that recipient as it was presented to the remote SMTP server ๐Ÿซง

(k) other per-recipient fields defined in [5] MAY appear, as appropriate ๐ŸŒท

8. Acknowledgments ๐Ÿซถ

the author wants to thank Eric Allman, Harald Alvestrand, Jim Conklin, Bryan Costales, Peter Cowen, Dave Crocker, Roger Fajman, Ned Freed, Marko Kaittola, Steve Kille, John Klensin, Anastasios Kotsikonas, John Gardiner Myers, Julian Onions, Jacob Palme, Marshall Rose, Greg Vaudreuil, and Klaus Weide for their suggestions for improving this document ๐Ÿ’•

9. Appendix - Type-Name Definitions ๐Ÿงš

the following type names are defined for use in DSN fields generated by conforming SMTP-based MTAs ๐ŸŒˆ

9.1 "rfc822" address-type

the "rfc822" address-type is used when reporting an Internet electronic mail address in the Original-Recipient and Final-Recipient DSN fields ๐Ÿ’Œ

(a) address-type name: rfc822

(b) syntax for mailbox addresses

RFC822 mailbox addresses are generally expected to look like this:

[route] addr-spec

where "route" and "addr-spec" are defined in [2], and the "domain" portions of both "route" and "addr-spec" are fully-qualified domain names registered in the DNS. however, an MTA MUST NOT modify an address obtained from the message envelope to force it to conform to syntax rules ๐Ÿšซ

(c) if addresses of this type aren't made up entirely of graphic characters from the US-ASCII repertoire, there has to be a spec for how they get encoded as graphic US-ASCII characters in a DSN Original-Recipient or Final-Recipient field ๐Ÿ”ค

RFC822 addresses are made up entirely of graphic characters from the US-ASCII repertoire, so no translation is necessary ๐Ÿ™Œ

9.2 "smtp" diagnostic-type

the "smtp" diagnostic-type is used when reporting SMTP reply-codes in Diagnostic-Code DSN fields ๐ŸŽ€

(a) diagnostic-type name: SMTP

(b) bestie, the syntax to be used for expressing diagnostic

...so you're writing diagnostic codes of this type as graphic characters from the US-ASCII repertoire ๐Ÿ”คโœจ

An SMTP diagnostic-code is shaped like this ๐Ÿ‘€

*( 3*DIGIT "-" *text ) 3*DIGIT SPACE *text

Okay, so for a single-line SMTP reply to an SMTP command, the diagnostic-code SHOULD be an exact transcription of the reply ๐Ÿ’… For multi-line SMTP replies, you gotta insert a SPACE before each line after the first. (This is the part people forget, bestie ๐Ÿ™ˆ) Here's an example. An SMTP reply that looks like this:

550-mailbox unavailable
550 user has moved with no forwarding address

could show up like this in a Diagnostic-Code DSN field:

Diagnostic-Code: smtp ; 550-mailbox unavailable
 550 user has moved with no forwarding address

(c) Next up is the list of valid diagnostic codes of this type, plus what each code means ๐Ÿ“‹

SMTP reply-codes are currently defined in [1], [4], and [9]. Additional codes may be defined by other RFCs. ๐ŸŒธ


9.3. "dns" MTA-name-type ๐ŸŒ

The "dns" MTA-name-type should be used in the Reporting-MTA field ๐Ÿ’– An MTA-name of type "dns" is a fully-qualified domain name. The name must be registered in the DNS, and the address Postmaster@{mta-name} must be valid.

(a) MTA-name-type name: dns

(b) The syntax for MTA names of this type, written in BNF, regular expressions, ASN.1, or some other non-ambiguous language ๐Ÿง 

MTA names of type "dns" SHOULD be valid Internet domain names. If such domain names aren't available, a domain-literal containing the internet protocol address is acceptable. Such domain names generally conform to the following syntax:

domain = real-domain / domain-literal

real-domain = sub-domain *("." sub-domain)

sub-domain = atom

domain-literal = "[" 1*3DIGIT 3("." 1*3DIGIT) "]"

where atom and DIGIT are defined in [2] ๐Ÿ“–

(c) If MTA names of this type don't consist entirely of graphic characters from the US-ASCII repertoire, there needs to be a specification for how an MTA name of this type should be expressed as a sequence of graphic US-ASCII characters. Good news, though: MTA names of type "dns" consist entirely of graphic US-ASCII characters, so no translation is needed ๐ŸŽ‰


10. Appendix - Example ๐ŸŽฌ

This example follows one message from start to finish. It's addressed to a whole crew of recipients, each with their own per-recipient options ๐Ÿ’Œ The message is sent by Alice@Pure-Heart.ORG to Bob@Big-Bucks.COM, Carol@Ivory.EDU, Dana@Ivory.EDU, Eric@Bombs.AF.MIL, Fred@Bombs.AF.MIL, and George@Tax-ME.GOV, with a variety of per-recipient options. The message is successfully delivered to Bob, Dana (via a gateway), Eric, and Fred. Delivery fails for Carol and George ๐Ÿ˜ญ

NOTE: Formatting rules for RFCs require that no line be longer than 72 characters. Therefore, in the following examples, some SMTP commands longer than 72 characters are printed on two lines, with the first line ending in \. In an actual SMTP transaction, such a command would be sent as a single line (i.e. with no embedded CRLFs), and without the \ character that appears in these examples. ๐Ÿ“

10.1. Submission ๐Ÿ“ฌ

Alice's user agent sends the message to the SMTP server at Pure-Heart.ORG. Note that while this example uses SMTP as a mail submission protocol, other protocols could also be used. ๐Ÿ’ก

<<< 220 Pure-Heart.ORG SMTP server here
>>> EHLO Pure-Heart.ORG
<<< 250-Pure-Heart.ORG
<<< 250-DSN
<<< 250-EXPN
<<< 250 SIZE
>>> MAIL FROM:<Alice@Pure-Heart.ORG> RET=HDRS ENVID=QQ314159
<<< 250 <Alice@Pure-Heart.ORG> sender ok
>>> RCPT TO:<Bob@Big-Bucks.COM> NOTIFY=SUCCESS \
    ORCPT=rfc822;Bob@Big-Bucks.COM
<<< 250 <Bob@Big-Bucks.COM> recipient ok
>>> RCPT TO:<Carol@Ivory.EDU> NOTIFY=FAILURE \
    ORCPT=rfc822;Carol@Ivory.EDU
<<< 250 <Carol@Ivory.EDU> recipient ok
>>> RCPT TO:<Dana@Ivory.EDU> NOTIFY=SUCCESS,FAILURE \
    ORCPT=rfc822;Dana@Ivory.EDU
<<< 250 <Dana@Ivory.EDU> recipient ok
>>> RCPT TO:<Eric@Bombs.AF.MIL> NOTIFY=FAILURE \
    ORCPT=rfc822;Eric@Bombs.AF.MIL
<<< 250 <Eric@Bombs.AF.MIL> recipient ok
>>> RCPT TO:<Fred@Bombs.AF.MIL> NOTIFY=NEVER
<<< 250 <Fred@Bombs.AF.MIL> recipient ok
>>> RCPT TO:<George@Tax-ME.GOV> NOTIFY=FAILURE \
    ORCPT=rfc822;George@Tax-ME.GOV
<<< 250 <George@Tax-ME.GOV> recipient ok
>>> DATA
<<< 354 okay, send message
>>> (message goes here)
>>> .
<<< 250 message accepted
>>> QUIT
<<< 221 goodbye

10.2. Relay to Big-Bucks.COM ๐Ÿšš

The SMTP at Pure-Heart.ORG then relays the message to Big-Bucks.COM. (For the purpose of this example, mail.Big-Bucks.COM is the primary mail exchanger for Big-Bucks.COM.)

<<< 220 mail.Big-Bucks.COM says hello
>>> EHLO Pure-Heart.ORG
<<< 250-mail.Big-Bucks.COM
<<< 250 DSN
>>> MAIL FROM:<Alice@Pure-Heart.ORG> RET=HDRS ENVID=QQ314159
<<< 250 sender okay
>>> RCPT TO:<Bob@Big-Bucks.COM> NOTIFY=SUCCESS \
    ORCPT=rfc822;Bob@Big-Bucks.COM
<<< 250 recipient okay
>>> DATA
<<< 354 send message
>>> (message goes here)
>>> .
<<< 250 message received
>>> QUIT
<<< 221 bcnu

10.3. Relay to Ivory.EDU ๐Ÿซ

Here's where it gets a little spicy ๐ŸŒถ๏ธ The SMTP at Pure-Heart.ORG relays the message to Ivory.EDU, which (as it happens) is a gateway to a LAN-based mail system that accepts SMTP mail and supports the DSN extension.

<<< 220 Ivory.EDU gateway to FooMail(tm) here
>>> EHLO Pure-Heart.ORG
<<< 250-Ivory.EDU
<<< 250 DSN
>>> MAIL FROM:<Alice@Pure-Heart.ORG> RET=HDRS ENVID=QQ314159
<<< 250 ok
>>> RCPT TO:<Carol@Ivory.EDU> NOTIFY=FAILURE \
    ORCPT=rfc822;Carol@Ivory.EDU
<<< 550 error - no such recipient
>>> RCPT TO:<Dana@Ivory.EDU> NOTIFY=SUCCESS,FAILURE \
    ORCPT=rfc822;Dana@Ivory.EDU
<<< 250 recipient ok
>>> DATA
<<< 354 send message, end with '.'
>>> (message goes here)
>>> .
<<< 250 message received
>>> QUIT
<<< 221 bye

Note that since Ivory.EDU refused to accept mail for Carol@Ivory.EDU, and the sender specified NOTIFY=FAILURE, the sender-SMTP (in this case Pure-Heart.ORG) must generate a DSN. ๐Ÿ™…โ€โ™€๏ธ

10.4. Relay to Bombs.AF.MIL ๐ŸŒท

The SMTP at Pure-Heart.ORG relays the message to Bombs.AF.MIL, which does not support the SMTP extension. Because the sender specified NOTIFY=NEVER for recipient Fred@Bombs.AF.MIL, the SMTP at Pure-Heart.ORG chooses to send the message for that recipient in a separate transaction with a reverse-path of <>.

<<< 220-Bombs.AF.MIL reporting for duty.
<<< 220 Electronic mail is to be used for official business only.
>>> EHLO Pure-Heart.ORG
<<< 502 command not implemented
>>> RSET
<<< 250 reset
>>> HELO Pure-Heart.ORG
<<< 250 Bombs.AF.MIL
>>> MAIL FROM:<Alice@Pure-Heart.ORG>
<<< 250 ok
>>> RCPT TO:<Eric@Bombs.AF.MIL>
<<< 250 ok
>>> DATA
<<< 354 send message
>>> (message goes here)
>>> .
<<< 250 message accepted
>>> MAIL FROM:<>
<<< 250 ok
>>> RCPT TO:<Fred@Bombs.AF.MIL>
<<< 250 ok
>>> DATA
<<< 354 send message
>>> (message goes here)
>>> .
<<< 250 message accepted
>>> QUIT
<<< 221 Bombs.AF.MIL closing connection

10.5. Forward from George@Tax-ME.GOV to Sam@Boondoggle.GOV ๐Ÿงš

The SMTP at Pure-Heart.ORG relays the message to Tax-ME.GOV (this step is not shown). MTA Tax-ME.GOV then forwards the message to Sam@Boondoggle.GOV (shown below). Both Tax-ME.GOV and Pure-Heart.ORG support the SMTP DSN extension. Note that RET, ENVID, and ORCPT all retain their original values. ๐Ÿ”

<<< 220 BoonDoggle.GOV says hello
>>> EHLO Pure-Heart.ORG
<<< 250-mail.Big-Bucks.COM
<<< 250 DSN
>>> MAIL FROM:<Alice@Pure-Heart.ORG> RET=HDRS ENVID=QQ314159
<<< 250 sender okay
>>> RCPT TO:<Sam@Boondoggle.GOV> NOTIFY=SUCCESS \
    ORCPT=rfc822;George@Tax-ME.GOV
<<< 250 recipient okay
>>> DATA
<<< 354 send message
>>> (message goes here)
>>> .
<<< 250 message received
>>> QUIT
<<< 221 bcnu

10.6. "Delivered" DSN for Bob@Big-Bucks.COM ๐ŸŽ€

MTA mail.Big-Bucks.COM successfully delivers the message to Bob@Big-Bucks.COM. Because the sender specified NOTIFY=SUCCESS, mail.Big-Bucks.COM issues the following DSN and sends it to Alice@Pure-Heart.ORG. ๐Ÿ’–

To: Alice@Pure-Heart.ORG
From: postmaster@mail.Big-Bucks.COM
Subject: Delivery Notification (success) for Bob@Big-Bucks.COM
Content-Type: multipart/report; report-type=delivery-status;
    boundary=abcde
MIME-Version: 1.0

--abcde
Content-type: text/plain; charset=us-ascii

Your message (id QQ314159) was successfully delivered to
Bob@Big-Bucks.COM.

--abcde
Content-type: message/delivery-status

Reporting-MTA: dns; mail.Big-Bucks.COM
Original-Envelope-ID: QQ314159

Original-Recipient: rfc822;Bob@Big-Bucks.COM
Final-Recipient: rfc822;Bob@Big-Bucks.COM
Action: delivered
Status: 2.0.0

--abcde
Content-type: message/rfc822

(headers of returned message go here)

--abcde--

10.7. Failed DSN for Carol@Ivory.EDU ๐Ÿ’”

Because delivery to Carol failed and the sender specified NOTIFY=FAILURE for Carol@Ivory.EDU, MTA Pure-Heart.ORG (the SMTP client to which the failure was reported via SMTP) issues the following DSN.

To: Alice@Pure-Heart.ORG
From: postmaster@Pure-Heart.ORG
Subject: Delivery Notification (failure) for Carol@Ivory.EDU
Content-Type: multipart/report; report-type=delivery-status;
              boundary=bcdef
MIME-Version: 1.0

--bcdef
Content-type: text/plain; charset=us-ascii

Your message (id QQ314159) could not be delivered to
Carol@Ivory.EDU.

A transcript of the session follows:

(while talking to Ivory.EDU)
>>> RCPT TO:<Carol@Ivory.EDU> NOTIFY=FAILURE
<<< 550 error - no such recipient

--bcdef
Content-type: message/delivery-status

Reporting-MTA: dns; Pure-Heart.ORG
Original-Envelope-ID: QQ314159

Original-Recipient: rfc822;Carol@Ivory.EDU
Final-Recipient: rfc822;Carol@Ivory.EDU
SMTP-Remote-Recipient: Carol@Ivory.EDU
Diagnostic-Code: smtp; 550 error - no such recipient
Action: failed
Status: 5.0.0

--bcdef
Content-type: message/rfc822

(headers of returned message go here)

--bcdef--

10.8. Relayed DSN For Dana@Ivory.EDU ๐Ÿ“

Although the mail gateway Ivory.EDU supports the DSN SMTP extension, the LAN mail system attached to its other side does not generate positive delivery confirmations. So Ivory.EDU issues a "relayed" DSN:

To: Alice@Pure-Heart.ORG
From: postmaster@Ivory.EDU
Subject: mail relayed for Dana@Ivory.EDU
Content-Type: multipart/report; report-type=delivery-status;
    boundary=cdefg
MIME-Version: 1.0

--cdefg
Content-type: text/plain; charset=us-ascii

Your message (addressed to Dana@Ivory.EDU) was successfully
relayed to:

ymail!Dana

by the FooMail gateway at Ivory.EDU.

Unfortunately, the remote mail system does not support
confirmation of actual delivery.  Unless delivery to ymail!Dana
fails, this will be the only delivery status notification sent.

--cdefg
Content-type: message/delivery-status

Reporting-MTA: dns; Ivory.EDU
Original-Envelope-ID: QQ314159

Original-Recipient: rfc822;Dana@Ivory.EDU
Final-Recipient: rfc822;Dana@Ivory.EDU
Action: relayed
Status: 2.0.0

--cdefg
Content-type: message/rfc822

(headers of returned message go here)

--cdefg--

10.9. Failure notification for Sam@Boondoggle.GOV ๐ŸŒง๏ธ

The message originally addressed to George@Tax-ME.GOV was forwarded to Sam@Boondoggle.GOV, but the MTA for Boondoggle.GOV was unable to deliver the message due to a lack of disk space in Sam's mailbox. After trying for several days, Boondoggle.GOV returned the following DSN:

To: Alice@BigHeart.ORG
From: Postmaster@Boondoggle.GOV
Subject: Delivery failure for Sam@Boondoggle.GOV
Content-Type: multipart/report; report-type=delivery-status;
              boundary=defgh
MIME-Version: 1.0

--defgh
Your message, originally addressed to George@Tax-ME.GOV, and forwarded
from there to Sam@Boondoggle.GOV could not be delivered, for the
following reason:

write error to mailbox, disk quota exceeded

--defgh
Content-type: message/delivery-status

Reporting-MTA: Boondoggle.GOV
Original-Envelope-ID: QQ314159

Original-Recipient: rfc822;George@Tax-ME.GOV
Final-Recipient: rfc822;Sam@Boondoggle.GOV
Action: failed
Status: 4.2.2 (disk quota exceeded)

--defgh
Content-type: message/rfc822

(headers of returned message go here)

--defgh--

11. References ๐Ÿ“šโœจ

okay bestie, here are the receipts ๐Ÿงพ๐Ÿ’… every source this spec leans on, so you can go read them yourself if you want the full story

  • [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] Westine, A., and J. Postel, "Problems with the Maintenance of Large Mailing Lists.", RFC 1211, USC/Information Sciences Institute, March 1991.
  • [4] Klensin, J., Freed, N., Rose, M., Stefferud, E., and D. Crocker, "SMTP Service Extensions", RFC 1651, MCI, Innosoft, Dover Beach Consulting, Inc., Network Management Associates, Inc., Silicon Graphics, Inc., July 1994.
  • [5] Moore, K., and G. Vaudreuil, "An Extensible Message Format for Delivery Status Notifications", RFC 1894, University of Tennessee, Octel Network Services, January 1996.
  • [6] Crispin, M., "Internet Message Access Protocol - Version 4", RFC 1730, University of Washington, 20 December 1994.
  • [7] Myers, J., and M. Rose, "Post Office Protocol - Version 3", RFC 1725, Carnegie Mellon, Dover Beach Consulting, November 1994.
  • [8] Vaudreuil, G., "The Multipart/Report Content Type for the Reporting of Mail System Administrative Messages", RFC 1892, Octel Network Services, January 1996.
  • [9] Braden, R., Editor, "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, IETF, October 1989.
  • [10] Vaudreuil, G., "Enhanced Mail System Status Codes", RFC 1893, Octel Network Services, January 1996.

12. Author's Address ๐Ÿ–Š๏ธ๐Ÿฆ‹

meet the human behind the spec ๐Ÿซถ here's where to find Keith ๐Ÿ’Œ

   Keith Moore
   University of Tennessee
   107 Ayres Hall
   Knoxville, TN 37996-1301
   USA

   EMail: moore@cs.utk.edu
๐Ÿ“ฆ where this page comes from