RFC 3464

An Extensible Message Format for Delivery Status Notifications

๐Ÿ“… published January 2003, from ietf

An Extensible Message Format for Delivery Status Notifications ๐Ÿ’Œ

Okay bestie, this is RFC 3464 ๐ŸŽ€ It came from the Network Working Group, written by K. Moore (University of Tennessee) and G. Vaudreuil (Lucent Technologies) in January 2003. It's a Standards Track doc, and it obsoletes RFC 1894 โœจ

Status of this Memo

This document is an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐Ÿซถ Check the current edition of "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited ๐Ÿฆ‹

Copyright (C) The Internet Society (2003). All Rights Reserved. ๐Ÿ’œ

Abstract

Okay so this memo defines a Multipurpose Internet Mail Extensions (MIME) content-type ๐Ÿ’… A message transfer agent (MTA) or an electronic mail gateway can use it to report whether an attempt to deliver a message to one or more recipients worked. It's meant to be a machine-processable replacement for all the different delivery status notifications currently floating around Internet email ๐Ÿงš

Messages get sent between the Internet and other messaging systems all the time, like X.400 or the so-called "Local Area Network (LAN)-based" systems ๐ŸŒˆ So the Delivery Status Notification (DSN) protocol is built to work in a multi-protocol messaging environment. The protocol here carries "foreign" addresses and error codes too, not just the ones normally used in Internet mail. It's giving flexibility โœจ Extra attributes can also be defined to support "tunneling" of foreign notifications through Internet mail ๐Ÿ”ฅ

Table of Contents

   1. Introduction ....................................................3
     1.1 Purposes .....................................................3
     1.2 Requirements .................................................4
     1.3 Terminology ..................................................5
   2. Format of a Delivery Status Notification ........................7
     2.1 The message/delivery-status content-type .....................9
      2.1.1 General conventions for DSN fields ........................9
      2.1.2 "*-type" sub-fields .......................................9
      2.1.3 Lexical tokens imported from RFC 822 .....................10
     2.2 Per-Message DSN Fields ......................................11
      2.2.1 The Original-Envelope-Id field ...........................11
      2.2.2 The Reporting-MTA DSN field ..............................12
      2.2.3 The DSN-Gateway field ....................................13
      2.2.4 The Received-From-MTA DSN field ..........................14
      2.2.5 The Arrival-Date DSN field ...............................14
     2.3 Per-Recipient DSN fields ....................................14
      2.3.1 Original-Recipient field .................................15
      2.3.2 Final-Recipient field ....................................15
      2.3.3 Action field .............................................16
      2.3.4 Status field .............................................18
      2.3.5 Remote-MTA field .........................................19
      2.3.6 Diagnostic-Code field ....................................19
      2.3.7 Last-Attempt-Date field ..................................20
      2.3.8 final-log-id field .......................................20
      2.3.9 Will-Retry-Until field ...................................20
     2.4 Extension fields ............................................21
   3. Conformance and Usage Requirements .............................22
   4. Security Considerations ........................................23
     4.1 Forgery .....................................................23
     4.2 Confidentiality .............................................23
     4.3 Non-Repudiation .............................................25
   5. References .....................................................25
   6. Acknowledgments ................................................26
   Appendix A - Collected Grammar ....................................27
   Appendix B - Guidelines for Gatewaying DSNS .......................29
     Gatewaying from other mail systems to DSNs ......................29
     Gatewaying from DSNs to other mail systems ......................30
   Appendix C - Guidelines for Use of DSNS By Mailing List Exploders .30
   Appendix D - IANA Registration Forms for DSN Types ................31
     IANA registration form for address-type .........................32
     IANA registration form for diagnostic-type ......................32
     IANA registration form for MTA-name-type ........................32
   Appendix E - Examples .............................................33
     Simple DSN ......................................................34
     Multi-Recipient DSN .............................................35
     DSN from gateway to foreign system ..............................36
     Delayed DSN .....................................................37
   Appendix F - Changes from RFC 1894 ................................38
   Authors' Addresses ................................................39
   Full Copyright Statement ..........................................40

1. Introduction ๐ŸŒธ

This memo defines a MIME [MIME1] content-type for Delivery Status Notifications (DSNs) ๐Ÿ’– A DSN can tell the sender of a message about a few different things: failed delivery, delayed delivery, successful delivery, or a message getting gatewayed into an environment that might not support DSNs at all ๐Ÿ˜ญ The "message/delivery-status" content-type defined here is meant to be used inside the "multipart/report" content type defined in [REPORT] โœจ

This memo only covers the format of the notifications ๐Ÿ™ˆ An extension to the Simple Message Transfer Protocol (SMTP) [SMTP] that fully supports them is a whole separate memo [DRPT] ๐Ÿ’…

Document Conventions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14, RFC 2119 [RFC2119] ๐Ÿงš

1.1 Purposes

Okay, so DSNs in this memo are supposed to do a few jobs ๐Ÿ“

  • (a) Tell humans what's going on with message delivery processing, plus the reasons for any delivery problems or straight-up failures, in a way that doesn't depend on human language or media ๐ŸŒˆ
  • (b) Let mail user agents track the delivery status of messages they sent, by matching returned DSNs to earlier message transmissions ๐Ÿฆ‹
  • (c) Let mailing list exploders automatically maintain their subscriber lists when delivery attempts keep failing ๐Ÿ’€
  • (d) Carry delivery and non-delivery notifications that come back from attempts to deliver messages to "foreign" mail systems through a gateway ๐Ÿ”ฅ
  • (e) Let "foreign" notifications get tunneled through a MIME-capable message system and back into the original messaging system that issued the original notification, or even over to a third messaging system ๐Ÿ‘‘
  • (f) Give language-independent and medium-independent, yet reasonably precise, indications of why a message failed to be delivered; and ๐Ÿ’œ
  • (g) Provide enough information to remote MTA maintainers (via "trouble tickets") so they can understand the nature of reported errors ๐Ÿซถ This comes up when a delivery failure is due to a malfunctioning remote MTA and the sender wants to report the problem to the remote MTA administrator ๐Ÿ˜ญ

1.2 Requirements

Okay bestie, these purposes put the following constraints on the notification protocol ๐Ÿ’…

  • (a) It must be readable by humans as well as being machine-parsable. โœจ
  • (b) It must provide enough information to allow message senders (or the user agents) to unambiguously associate a DSN with the message that was sent and the original recipient address for which the DSN is issued (if such information is available), even if the message was forwarded to another recipient address. ๐ŸŽ€
  • (c) It must be able to preserve the reason for the success or failure of a delivery attempt in a remote messaging system, using the "language" (mailbox addresses and status codes) of that remote system. ๐ŸŒธ
  • (d) It must also be able to describe the reason for the success or failure of a delivery attempt, independent of any particular human language or of the "language" of any particular mail system. ๐ŸŒˆ
  • (e) It must preserve enough information to allow the maintainer of a remote MTA to understand (and if possible, reproduce) the conditions that caused a delivery failure at that MTA. ๐Ÿ”ฅ
  • (f) For any notifications issued by foreign mail systems, which are translated by a mail gateway to the DSN format, the DSN must preserve the "type" of the foreign addresses and error codes, so that these may be correctly interpreted by gateways. ๐Ÿงš

A DSN contains a set of per-message fields that identify the message and the transaction during which the message was submitted, along with other fields that apply to all delivery attempts described by the DSN ๐Ÿฆ‹ It also includes a set of per-recipient fields to convey the result of the attempt to deliver the message to each of one or more recipients ๐Ÿ’–

1.3 Terminology โœจ

okay so a message can hop through a bunch of message transfer agents (MTAs) on its way to the recipient ๐Ÿš‚๐Ÿ’จ. along the way, recipient addresses can get rewritten for all sorts of reasons, so each MTA might see a totally different version of the address. which version you need depends on what the DSN is being used for ๐Ÿ’…

some DSN fields are described from the point of view of one particular MTA, so we give each MTA a name ๐ŸŽ€

(a) Original MTA

The Original MTA is the one the sender hands the message to for delivery. it's the starting point, the OG ๐Ÿ‘‘

(b) Reporting MTA

For any DSN, the Reporting MTA is the one reporting on the delivery attempts that the DSN describes ๐Ÿ“‹

if those delivery attempts happened in a "foreign" (non-Internet) mail system, and the DSN was made by translating that foreign notice into DSN format, the Reporting MTA still names the "foreign" MTA where the attempts actually happened ๐ŸŒ

(c) Received-From MTA

The Received-From MTA is the MTA that the Reporting MTA got the message from. the Reporting MTA accepted responsibility for delivering it, so this one is the one that handed it over ๐Ÿค

(d) Remote MTA

okay this one is a plot twist ๐Ÿ˜ญ. if an MTA has to relay a message to one or more recipients, but it can't get the message to its "next hop" MTA, or the "next hop" MTA refuses to take responsibility for delivering it to some of the intended recipients, the relaying MTA might need to send a DSN on behalf of those recipients. in that case the relaying MTA is the Reporting MTA, and the "next hop" MTA gets called the Remote MTA ๐Ÿฆ‹

here's a little picture of how all these MTAs fit together ๐Ÿ–ผ๏ธ

+-----+    +--------+           +---------+    +---------+      +------+
|     |    |        |           |Received-|    |         |      |      |
|     | => |Original| => ... => |  From   | => |Reporting| ===> |Remote|
| user|    |   MTA  |           |   MTA   |    |   MTA   | <No! |  MTA |
|agent|    +--------+           +---------+    +----v----+      +------+
|     |                                             |
|     | <-------------------------------------------+
+-----+      (DSN returned to sender by Reporting MTA)

     Figure 1. Original, Received-From, Reporting and Remote MTAs

every one of these MTAs can bring something useful to a DSN ๐Ÿ“

  • ideally, the DSN has each recipient's address exactly as the sender originally typed it into the Original MTA โœจ

this is the version we want (not a forwarding address, and not some edited version of the original) so the sender can check the address in the DSN against their own records, like an address book for a person or the subscriber list for a mailing list, and then do whatever needs doing ๐Ÿ“’

the DSN might also include an "envelope identifier" that the sender's user agent and the Original MTA both knew about when the message was submitted. if it's included, the sender can use it to track which messages did and didn't get delivered ๐ŸŽฏ

  • if a message was (a) forwarded to a different address than the sender picked, (b) gatewayed into a different mail system than the sender's, or (c) had its address rewritten along the way, the "final" recipient address (the one the Reporting MTA saw) will be different from the original one the sender typed ๐Ÿ”€

the sender's user agent (or the sender) prefers the original address, but the "final" address matters when reporting a problem to the postmaster at the site where delivery failed. honestly, only the final address lets her recreate the exact conditions that caused the failure ๐Ÿ•ต๏ธโ€โ™€๏ธ

  • a "failed" DSN should include the most accurate explanation for the failure that's available ๐Ÿ”

to make it easy to read, this info should be in a format that doesn't depend on the mail transport system that produced the DSN. but if a foreign error code gets translated into a transport-independent format, some details can get lost ๐Ÿ˜ฌ so it's really nice to have both a transport-independent status code and a way to report transport-specific codes too. depending on what caused the failure, the transport-specific code might come from either the Reporting MTA or the Remote MTA ๐Ÿ’œ

here's the thing, though. the right values for "recipient address" and "delivery status code" depend on how the DSN is going to be used, and the MTA issuing the DSN can't predict that. so the DSN format is allowed to carry both the original and final forms of a recipient address, plus both a transport-independent and a transport-specific delivery status ๐ŸŽ€

the Reporting MTA can also add extension fields when it needs to, either to give extra info for a trouble ticket or to keep info around so foreign delivery reports can be tunneled through Internet DSNs ๐Ÿš‡

the Original, Reporting, and Remote MTAs can live in really different environments and use totally different transport protocols, MTA names, address formats, and delivery status codes. so DSNs don't assume any specific format for mailbox addresses, MTA names, or transport-specific status codes ๐ŸŒˆ instead, the DSN fields that carry these things have a "type" sub-field, followed by a sub-field of ordinary text characters, and the "type" sub-field tells you what format the text is in. that's how a DSN can carry these values no matter what format they're in โญ


2. Format of a Delivery Status Notification ๐Ÿ’Œ

a DSN is a MIME message whose top-level content-type is multipart/report (defined in [REPORT]). when multipart/report content is used to send a DSN:

  • (a) the report-type parameter of the multipart/report content is "delivery-status" ๐Ÿท๏ธ
  • (b) the first component of the multipart/report has a human-readable explanation of the DSN, as described in [REPORT] ๐Ÿ“–
  • (c) the second component of the multipart/report is content-type message/delivery-status, described in section 2.1 of this document ๐ŸŽ
  • (d) if the original message, or a part of it, is going back to the sender, it shows up as the third component of the multipart/report ๐Ÿ”

NOTE: for delivery status notifications gatewayed from foreign systems, the headers of the original message might not be available ๐Ÿ™ˆ. in that case the third component of the DSN can be left out, or it can contain "simulated" RFC 822 headers that hold equivalent info. it's really desirable to keep the subject, date, and message-id (or equivalent) fields from the original message ๐Ÿซถ

the DSN MUST be addressed (in both the message header and the transport envelope) to the return address from the transport envelope that came with the original message the DSN was generated for. (for a message that arrived via SMTP, the envelope return address shows up in the MAIL FROM command.) ๐Ÿ“ฎ

the From field of the DSN's message header SHOULD contain the address of a human who is responsible for keeping the mail system running at the Reporting MTA site (for example, Postmaster), so a reply to the DSN actually reaches that person ๐Ÿง‘โ€๐Ÿ’ป. exception: if a DSN is translated from a foreign delivery report, and the gateway doing the translation can't work out the right address, the From field of the DSN MAY be the address of a human who is responsible for keeping the gateway running ๐ŸŒ‰

the envelope sender address of the DSN SHOULD be picked so that no delivery status reports get sent in response to the DSN itself. it MUST also be picked so that DSNs won't create mail loops ๐Ÿ”„๐Ÿšซ. whenever an SMTP transaction is used to send a DSN, the MAIL FROM command MUST use a NULL return address, i.e., MAIL FROM:<> ๐Ÿ’€

a single DSN describes the delivery status for exactly one message. however, an MTA MAY report on the delivery status for several recipients of the same message in one DSN ๐Ÿ“ฆ. because of how mail transport works (responsibility for delivering a message to its recipients can be split among several MTAs, and delivery to any given recipient can be delayed), multiple DSNs can still be issued in response to a single message submission ๐ŸŒ€

2.1 The message/delivery-status content-type ๐ŸŽ€

the message/delivery-status content-type is defined like this ๐Ÿ“œ

   MIME type name:             message
   MIME subtype name:          delivery-status
   Optional parameters:        none
   Encoding considerations:    "7bit" encoding is sufficient and
                               MUST be used to maintain readability
                               when viewed by non-MIME mail readers.
   Security considerations:    discussed in section 4 of this memo.

in the multipart/report, the report type for message/delivery-status is "delivery-status" ๐Ÿท๏ธ

the body of a message/delivery-status is made of one or more "fields", formatted according to the ABNF of RFC 822 header "fields" (see [RFC822]). the per-message fields come first, followed by a blank line. after the per-message fields come one or more groups of per-recipient fields, and each group of per-recipient fields is preceded by a blank line. here's the syntax of message/delivery-status content, written in RFC 822 ABNF ๐Ÿงฉ

        delivery-status-content =  per-message-fields 1*
                                  ( CRLF per-recipient-fields )

the per-message fields are described in section 2.2, and the per-recipient fields are described in section 2.3 ๐Ÿ“š

2.1.1 General conventions for DSN fields ๐Ÿง

these fields are defined using the rules of RFC 822, so the same conventions for continuation lines and comments apply ๐Ÿซง. a notification field can be continued onto several lines by starting each extra line with a SPACE or HTAB. text inside parentheses counts as a comment and isn't part of that notification field's contents ๐Ÿ’ฌ. field names are case-insensitive, so notification field names can be spelled in any mix of upper and lower case letters ๐Ÿ”ค. comments in DSN fields can use the "encoded-word" construct defined in [MIME3] ๐Ÿ’–

2.1.2 "*-type" sub-fields ๐ŸŽ€

Okay, bestie, a bunch of DSN fields are built from a "-type" sub-field, then a semicolon, then "text" ๐Ÿงš The keyword in that sub-field tells you what format the address, status-code, or MTA-name that follows should look like. So the keyword basically *is the instructions ๐Ÿ’…

Here are the three "-type" sub-fields:

(a) An "address-type" says what format a mailbox address is in. For example, Internet mail addresses use the "rfc822" address-type ๐Ÿ“ฌ

address-type = atom

(b) A "diagnostic-type" says what format a status code is in. For example, when a DSN field holds a reply code reported via the Simple Mail Transfer Protocol [SMTP], the "smtp" diagnostic-type gets used ๐Ÿ”ฅ

diagnostic-type = atom

(c) An "MTA-name-type" says what format an MTA name is in. For example, for an SMTP server on an Internet host, the MTA name is that host's domain name, and the "dns" MTA-name-type gets used ๐ŸŒธ

mta-name-type = atom

Values for address-type, diagnostic-type, and MTA-name-type are case-insensitive, so "RFC822" and "rfc822" count as the same thing โœจ

The Internet Assigned Numbers Authority (IANA) keeps a registry of address-types, diagnostic-types, and MTA-name-types. Each one comes with a description of what it means and what values are okay, or with a reference to one or more specifications that describe it. (The "rfc822" address-type, "smtp" diagnostic-type, and "dns" MTA-name-type are defined in [DRPT].) Registration forms for address-type, diagnostic-type, and MTA-name-type show up in Appendix D ๐Ÿฆ‹

IANA will not accept registrations for any address-type, diagnostic-type, or MTA-name-type name that starts with "X-". Those names are reserved for experimental use ๐Ÿงช

2.1.3 Lexical tokens imported from RFC 822 ๐Ÿ“š

The following lexical tokens are borrowed from [RFC822] and used in the ABNF grammar for DSNs: atom, CHAR, comment, CR, CRLF, DIGIT, LF, linear-white-space, SPACE, text. The date-time lexical token comes from [HOSTREQ] instead ๐Ÿซถ

2.2 Per-Message DSN Fields ๐Ÿ’œ

Some DSN fields apply to every delivery attempt that the DSN describes. Any of these fields can show up at most once in a DSN. Their whole job is to link the DSN back to the original message transaction and to give extra info that gateways might find useful ๐Ÿงš

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 ]
      *( extension-field CRLF )

2.2.1 The Original-Envelope-Id field ๐Ÿ†”

The optional Original-Envelope-Id field holds an "envelope identifier" that uniquely identifies the transaction in which the message was submitted. That ID was either (a) specified by the sender and handed to the sender's MTA, or (b) generated by the sender's MTA and made available to the sender when the message was submitted. Its purpose is to let the sender (or her user agent) match the returned DSN up with the exact transaction the message was sent in, so it's super useful ๐Ÿ’–

If that envelope identifier was in the envelope that came with the message when it reached the Reporting MTA, it SHOULD be supplied in the Original-Envelope-Id field of any DSNs issued because of an attempt to deliver the message. Except when a DSN is issued by the sender's MTA, an MTA MUST NOT supply this field unless there's an envelope-identifier field in the envelope that came with the message on its arrival at the Reporting MTA ๐Ÿ˜ญ

The Original-Envelope-Id field is defined like this:

original-envelope-id-field =
       "Original-Envelope-Id" ":" envelope-id

envelope-id = *text

There may be at most one Original-Envelope-Id field per DSN ๐ŸŒˆ

The envelope-id is CASE-SENSITIVE. The DSN MUST preserve the original case and spelling of the envelope-id. No cap, this one is strict ๐Ÿ’…

NOTE: The Original-Envelope-Id is NOT the same as the Message-Id from the message header. The Message-Id identifies the content of the message, while the Original-Envelope-Id identifies the transaction in which the message is sent. Don't mix these two up, bestie ๐Ÿ™ˆ

2.2.2 The Reporting-MTA DSN field ๐Ÿ“ฎ

reporting-mta-field =
      "Reporting-MTA" ":" mta-name-type ";" mta-name

mta-name = *text

The Reporting-MTA field is defined as follows:

A DSN describes the results of attempts to deliver, relay, or gateway a message to one or more recipients. In every case, the Reporting-MTA is the MTA that tried to perform the delivery, relay, or gateway operation the DSN describes. This field is required. โœจ

Quick aside: if an SMTP client tries to relay a message to an SMTP server and gets an error reply to a RCPT command, the client is the one responsible for generating the DSN, and the client's domain name shows up in the Reporting-MTA field. (The server's domain name shows up in the Remote-MTA field.) ๐Ÿฆ‹

The Reporting-MTA isn't necessarily the MTA that actually issued the DSN, though. For example, say an attempt to deliver a message outside the Internet gets a non-delivery notification, and that notification gets gatewayed back into Internet mail. The Reporting-MTA field of the resulting DSN would be the MTA that originally reported the delivery failure, not the gateway that converted the foreign notification into a DSN. See Figure 2 ๐Ÿ‘‘

 sender's environment                            recipient's environment
 ............................ ..........................................
                            : :
                        (1) : :                             (2)
   +-----+  +--------+  +--------+  +---------+  +---------+   +------+
   |     |  |        |  |        |  |Received-|  |         |   |      |
   |     |=>|Original|=>|        |->|  From   |->|Reporting|-->|Remote|
   | user|  |   MTA  |  |        |  |   MTA   |  |   MTA   |<No|  MTA |
   |agent|  +--------+  |Gateway |  +---------+  +----v----+   +------+
   |     |              |        |                    |
   |     | <============|        |<-------------------+
   +-----+              |        |(4)                (3)
                        +--------+
                            : :
 ...........................: :.........................................

Figure 2. DSNs in the presence of gateways ๐ŸŒธ

(1) message is gatewayed into recipient's environment
(2) attempt to relay message fails
(3) reporting-mta (in recipient's environment) returns non-delivery
    notification
(4) gateway translates foreign notification into a DSN

The mta-name part of the Reporting-MTA field gets formatted according to whatever conventions the mta-name-type sub-field points to. If an MTA works as a gateway between different mail environments and is known by multiple names depending on the environment, the mta-name sub-field SHOULD contain the name used by the environment that the Reporting-MTA accepted the message from ๐Ÿงš

Because the exact spelling of an MTA name can matter in a particular environment, MTA names are CASE-SENSITIVE ๐Ÿ”ฅ

2.2.3 The DSN-Gateway field ๐ŸŒ‰

The DSN-Gateway field names the gateway or MTA that translated a foreign (non-Internet) delivery status notification into this DSN. This field MUST appear in any DSN that a gateway translated from a foreign system into DSN format, and it MUST NOT appear otherwise. Strict, but iconic ๐Ÿ‘‘

dsn-gateway-field = "DSN-Gateway" ":" mta-name-type ";" mta-name

For gateways into Internet mail, the MTA-name-type will normally be "dns", and the mta-name will be the Internet domain name of the gateway ๐ŸŒ

2.2.4 The Received-From-MTA DSN field ๐Ÿ“ฅ

The optional Received-From-MTA field names the MTA the message was received from.

received-from-mta-field =
     "Received-From-MTA" ":" mta-name-type ";" mta-name

If the message came from an Internet host via SMTP, the mta-name sub-field SHOULD contain the Internet domain name given in the HELO or EHLO command, and the network address the SMTP client used SHOULD be included as a comment in parentheses. (In this case, the MTA-name-type will be "dns".) ๐Ÿ’–

The mta-name part of the Received-From-MTA field gets formatted according to the conventions the MTA-name-type sub-field points to.

Since case matters in some mail systems, the exact spelling of the MTA name, including case, SHOULD be preserved ๐Ÿซถ

2.2.5 The Arrival-Date DSN field ๐Ÿ•ฐ๏ธ

The optional Arrival-Date field says when the message reached the Reporting MTA. If the Last-Attempt-Date field also shows up in a per-recipient field, you can use the two together to work out how long it was between the message arriving at the Reporting MTA and the report being issued for that recipient โฐ

arrival-date-field = "Arrival-Date" ":" date-time

The date and time are written in RFC 822 'date-time' format, as modified by [HOSTREQ]. Numeric timezones ([+/-]HHMM format) MUST be used ๐ŸŒ

2.3 Per-Recipient DSN fields ๐ŸŽ€

A DSN holds info about attempts to deliver a message to one or more recipients. The delivery info for any one recipient lives in a group of contiguous per-recipient fields, and each group starts after a blank line ๐ŸŒธ

The syntax for a group of per-recipient fields looks like this:

per-recipient-fields =
      [ original-recipient-field CRLF ]
      final-recipient-field CRLF
      action-field CRLF
      status-field CRLF
      [ remote-mta-field CRLF ]
      [ diagnostic-code-field CRLF ]
      [ last-attempt-date-field CRLF ]
      [ final-log-id-field CRLF ]
      [ will-retry-until-field CRLF ]
      *( extension-field CRLF )

2.3.1 Original-Recipient field ๐Ÿง

The Original-Recipient field shows the original recipient address the sender specified for the message that the DSN is being issued for ๐Ÿ“ฌ

original-recipient-field =
      "Original-Recipient" ":" address-type ";" generic-address

generic-address = *text

The address-type field shows the type of the original recipient address. If the message started out inside the Internet, the address-type field will normally be "rfc822", and the address will follow the syntax in [RFC822]. The value "unknown" should be used if the Reporting MTA can't work out the type of the original recipient address from the message envelope ๐Ÿค”

This field is optional. It should be included only if the sender-specified recipient address was in the message envelope, for example through the SMTP extensions defined in [DRPT]. This address is the same as the one the sender gave, so it can be used to automatically match up DSN reports with message transactions. Iconic correlation energy ๐Ÿ’…โœจ

2.3.2 Final-Recipient field ๐Ÿ’Œ

The Final-Recipient field tells you which recipient this set of per-recipient fields is about ๐ŸŽ€ This field MUST be present in each set of per-recipient data.

The syntax is:

      final-recipient-field =
          "Final-Recipient" ":" address-type ";" generic-address

The generic-address sub-field of the Final-Recipient field MUST contain the mailbox address of the recipient (from the transport envelope), as it was when the Reporting MTA accepted the message for delivery ๐Ÿ“ฌ

The Final-Recipient address may not match what the sender originally typed, because it can get totally scrambled during forwarding and gatewaying ๐Ÿ˜ญ Still, if the optional Original-Recipient field isn't there, the Final-Recipient field and any returned content might be the only clues you have for matching the DSN to a particular message submission ๐Ÿ•ต๏ธโ€โ™€๏ธ

The address-type sub-field tells you what kind of address the reporting MTA expects in that context. Recipient addresses obtained via SMTP will normally be of address-type "rfc822" โœจ

NOTE: The Reporting MTA isn't expected to make sure the address follows the syntax rules for its address-type ๐Ÿ™…โ€โ™€๏ธ Instead, it MUST report exactly the address it received in the envelope, unless that address has characters like CR or LF, which aren't allowed in a DSN field.

Mailbox addresses (including the ones used on the Internet) can be case sensitive, so the case of alphabetic characters in the address MUST be preserved ๐Ÿ”  No capitalising it into a new look, bestie ๐Ÿ’…

2.3.3 Action field ๐Ÿ”ฅ

The Action field tells you what the Reporting-MTA actually did after trying to deliver the message to this recipient address ๐Ÿš€ This field MUST be present for each recipient named in the DSN.

The syntax for the action-field is:

         action-field = "Action" ":" action-value

         action-value =
               "failed" / "delayed" / "delivered" / "relayed" / "expanded"

The action-value can be spelled with any mix of upper and lower case characters ๐ŸŒˆ

  • failed: the message couldn't be delivered to the recipient ๐Ÿ’€ The Reporting MTA has given up on trying to deliver it to this recipient, so no further notifications should be expected.
  • delayed: the Reporting MTA hasn't been able to deliver or relay the message yet, but it's still trying ๐Ÿข More notification messages may come along if the message gets delayed further, gets delivered, or if the delivery attempts are eventually abandoned.
  • delivered: the message was successfully delivered to the recipient address the sender specified, and that includes "delivery" to a mailing list exploder ๐ŸŽ‰ It does NOT mean the message has been read ๐Ÿ‘€ This is a terminal state, so no further DSN for this recipient should be expected.
  • relayed: the message has been relayed or gatewayed into an environment that doesn't take responsibility for generating DSNs upon successful delivery ๐Ÿซ  This action-value SHOULD NOT be used unless the sender asked for notification of successful delivery for this recipient.
  • expanded: the message was successfully delivered to the recipient address the sender specified, and then the Reporting-MTA forwarded it on to multiple additional recipient addresses ๐Ÿฆ‹ expanded is different from delivered because it is NOT a terminal state. Further failed and/or delayed notifications may be provided.

Using the terms "mailing list" and "alias" as defined in [DRPT], section 7.2.7: an action-value of expanded is only to be used when the message is delivered to a multiple-recipient "alias" ๐Ÿงš An action-value of expanded SHOULD NOT be used with a DSN issued on delivery of a message to a "mailing list".

NOTE ON ACTION VS. STATUS CODES: Okay, the action field might look like it's just repeating the status field, but it's really not ๐Ÿ™…โ€โ™€๏ธ For example, a "temporary failure" (4) status code could go with an action-value of either delayed or failed. Say an SMTP client keeps trying to relay a message to the mail exchanger for a recipient, but it fails because a query to a domain name server timed out. After a few hours, it might send a delayed DSN to tell the sender the message still hasn't been delivered โณ After a few days, the MTA might give up and send a failed DSN. The status code (which would start with a 4 for "temporary failure") would be the same for both DSNs. Here's another one that looks contradictory: if an MTA or mail gateway can't deliver a message because doing so would mean conversions that cause an unacceptable loss of information, it would issue a DSN with the action field of "failure" and a status code of XXX. If the message had been relayed instead, but with some loss of information, it might generate a DSN with the same XXX status code, but with an action field of "relayed" ๐Ÿคฏ

2.3.4 Status field ๐Ÿ“Š

The per-recipient Status field holds a transport-independent status code that shows the delivery status of the message to that recipient โœจ This field MUST be present for each delivery attempt described by a DSN.

The syntax of the status field is:

   status-field = "Status" ":" status-code

   status-code = DIGIT "." 1*3DIGIT "." 1*3DIGIT

      ; White-space characters and comments are NOT allowed within
      ; a status-code, though a comment enclosed in parentheses
      ; MAY follow the last numeric sub-field of the status-code.
      ; Each numeric sub-field within the status-code MUST be
      ; expressed without leading zero digits.

Status codes are made up of three numerical fields separated by "." ๐Ÿ”ข The first sub-field tells you whether the delivery attempt was successful (2 = success, 4 = persistent temporary failure, 5 = permanent failure). The second sub-field shows the probable source of any delivery anomalies, and the third sub-field gives a precise error condition, if it's known ๐Ÿ•ต๏ธโ€โ™€๏ธ

The initial set of status-codes is defined in [STATUS] ๐Ÿ“š

2.3.5 Remote-MTA field ๐Ÿ›ฐ๏ธ

The value of the Remote-MTA DSN field is a printable ASCII representation of the name of the "remote" MTA that reported delivery status to the "reporting" MTA ๐Ÿ’Œ

   remote-mta-field = "Remote-MTA" ":" mta-name-type ";" mta-name

NOTE: The Remote-MTA field keeps the "while talking to" info that some older nondelivery reports used to include ๐Ÿซถ

This field is optional. It MUST NOT be included if no remote MTA was involved in attempting to deliver the message to that recipient ๐Ÿ™…โ€โ™€๏ธ

2.3.6 Diagnostic-Code field ๐Ÿฉบ

For a "failed" or "delayed" recipient, the Diagnostic-Code DSN field holds the actual diagnostic code issued by the mail transport ๐Ÿ” Those codes vary from one mail transport to another, so the diagnostic-type sub-field says which type of diagnostic code you're looking at ๐Ÿท๏ธ

    diagnostic-code-field =
          "Diagnostic-Code" ":" diagnostic-type ";" *text

NOTE: The Diagnostic-Code field can be a bit redundant with the Status field ๐Ÿ™ˆ The Status field exists so that any DSN, no matter where it came from, can be understood by any user agent or gateway that parses DSNs. But the Status code is sometimes less precise than the real transport diagnostic code, so the Diagnostic-Code field keeps that extra detail ๐Ÿง  It's handy in a trouble ticket sent to the Reporting MTA's administrator, or when foreign non-delivery reports are tunnelled through DSNs ๐Ÿš‡

If the Diagnostic Code came from a Remote MTA while trying to relay the message to that MTA, the Remote-MTA field SHOULD be present ๐Ÿ“ก When you're reading a DSN, a Remote-MTA field means the Diagnostic Code was issued by the Remote MTA. No Remote-MTA field means the Diagnostic Code was issued by the Reporting MTA.

On top of the Diagnostic-Code itself, some extra textual description of the diagnostic MAY appear in a comment enclosed in parentheses ๐Ÿ’ฌ

This field is optional, because some mail systems don't supply anything beyond what's already in the action and status fields ๐Ÿคทโ€โ™€๏ธ However, this field SHOULD be included if transport-specific diagnostic information is available โœจ

2.3.7 Last-Attempt-Date field โฐ

The Last-Attempt-Date field gives the date and time of the last attempt the Reporting MTA made to relay, gateway, or deliver the message, whether it worked or not ๐Ÿ•ฐ๏ธ This isn't always the same as the Date field in the header of the message used to send this delivery status notification. If a gateway generated the DSN, the Date field in the message header is when the DSN was sent by the gateway, while the DSN Last-Attempt-Date field is when the last delivery attempt actually happened ๐Ÿซ 

      last-attempt-date-field = "Last-Attempt-Date" ":" date-time

This field is optional. It MUST NOT be included if the actual date and time of the last delivery attempt aren't available, which might happen if the DSN is being issued by a gateway ๐Ÿšซ

The date and time are expressed in RFC 822 'date-time' format, as modified by [HOSTREQ]. Numeric timezones ([+/-]HHMM format) MUST be used ๐ŸŒ

2.3.8 final-log-id field ๐Ÿชต

The "final-log-id" field gives the final-log-id of the message that was used by the final-mta. It can be a useful index into the final-mta's log entry for that delivery attempt ๐Ÿ—‚๏ธ

      final-log-id-field = "Final-Log-ID" ":" *text

This field is optional.

2.3.9 Will-Retry-Until field โŒ›

For DSNs of type "delayed", the Will-Retry-Until field gives the date after which the Reporting MTA expects to stop trying to deliver the message to that recipient ๐Ÿ The Will-Retry-Until field is optional for "delay" DSNs, and it MUST NOT appear in other DSNs ๐Ÿ™…โ€โ™€๏ธ

      will-retry-until-field = "Will-Retry-Until" ":" date-time

The date and time are expressed in RFC 822 'date-time' format, as modified by [HOSTREQ]. Numeric timezones ([+/-]HHMM format) MUST be used ๐ŸŒธ

2.4. Extension fields โœจ

Okay bestie, so the DSN format can grow over time ๐ŸŒฑ Future revisions or extensions can define brand new per-message or per-recipient DSN fields ๐Ÿ’– But here's the vibe check: any extension field name starting with "X-" will NEVER become a standard field ๐Ÿ™…โ€โ™€๏ธ Those "X-" names are reserved for experimental use only ๐Ÿงช Any DSN field name that does NOT start with "X-" MUST be registered with the Internet Assigned Numbers Authority (IANA) and published in an RFC ๐Ÿ“œ No skipping that step, periodt ๐Ÿ’…

So why would anyone make an extension field? There are three main reasons ๐ŸŽ€

(a) To tunnel extra info from foreign delivery status reports through Internet DSNs ๐Ÿš‡ The field names should start with the name of the foreign environment, like X400-Physical-Forwarding-Address โœ‰๏ธ

(b) To carry diagnostic info that's specific to one particular mail transport protocol ๐Ÿšš The names should begin with the transport being used, like SMTP-Remote-Recipient-Address ๐Ÿ” These fields are for diagnostics ONLY, not for user agents or mail gateways to act on ๐Ÿ™…โ€โ™€๏ธ Like, hard boundary ๐Ÿ˜ค

(c) To carry diagnostic info that's specific to one particular message transfer agent (MTA) ๐Ÿค– The names should start with the name of the MTA implementation that made the DSN, like Foomail-Queue-ID ๐Ÿงพ

Now the MTA implementers get a little pep talk ๐Ÿ“ฃ They're encouraged to include enough info, using extension fields if needed, so that an MTA maintainer can understand what kind of correctable delivery failure happened and how to fix it ๐Ÿ› ๏ธ For example, if delivery attempts get logged, the DSN could include something that helps the maintainer quickly find the log entry for the failed attempt ๐Ÿ”Ž Main character maintainer energy ๐Ÿฆธโ€โ™€๏ธ

If an MTA developer doesn't want to register what their extension fields mean, they can use "X-" fields instead ๐Ÿง To avoid name collisions, the MTA implementation's name should follow the "X-", like X-Foomail-Log-ID ๐ŸŒธ

3. Conformance and Usage Requirements ๐ŸŽ€

Okay so, an MTA or gateway counts as conforming to this spec if it generates DSNs following the protocol in this memo ๐Ÿ’… For MTAs and gateways that don't support requests for positive delivery notification (like in [DRPT]), it's totally enough for their delivery failure reports to use this protocol ๐Ÿซถ

A minimal implementation only has to generate the Reporting-MTA per-message field, plus the Final-Recipient, Action, and Status fields for each attempt to deliver a message to a recipient the DSN describes ๐ŸŒธ Generating the other fields is strongly recommended when it makes sense ๐Ÿ’– Like, it's giving thorough ๐Ÿฅฐ

Here's a big one ๐Ÿšจ MTAs and gateways MUST NOT generate the Original-Recipient field of a DSN unless the mail transfer protocol actually provides the address the sender originally specified at submission time ๐Ÿ™…โ€โ™€๏ธ (Ordinary SMTP doesn't guarantee that ๐Ÿ˜ฌ but the SMTP extension defined in [DRPT] lets that info ride along in the envelope if it's available โœ‰๏ธ)

Each sender-specified recipient address SHOULD result in at most one "delivered" or "failed" DSN for that recipient ๐Ÿ“ฌ If a positive DSN is requested (for example, NOTIFY=SUCCESS in SMTP) for a recipient that forwards to multiple recipients of an "alias" (as defined in [DRPT], section 7.2.7), the forwarding MTA SHOULD normally send one "expanded" DSN for the originally-specified recipient and NOT pass the DSN request along to the forwarding addresses ๐Ÿฆ‹ Alternatively, the forwarding MTA MAY relay the DSN request to exactly one of the forwarding addresses and NOT pass it to the others ๐Ÿงš

Now the mailing list plot twist ๐ŸŒˆ Successfully submitting a message to a mailing list exploder counts as final delivery ๐ŸŽ‰ When a message gets delivered to a recipient address that belongs to a mailing list exploder, the Reporting MTA SHOULD issue an appropriate DSN, exactly as if that address were an ordinary mailbox ๐Ÿ’Œ

NOTE: This is actually meant to let mailing lists themselves use DSNs ๐Ÿซ  Any message sent to a mailing list subscriber should have its envelope return address pointing to the list maintainer [see RFC 1123, section 5.3.7(E)] ๐Ÿ‘‘ Since DSNs go to the envelope return address, every DSN from delivery to a mailing list's recipients will land with the list maintainer ๐Ÿ“ฅ The maintainer can choose to process DSNs mechanically when they arrive, and automatically delete invalid addresses from the list ๐Ÿงน (See section 7 of this memo.) ๐Ÿ’…

This spec puts NO restrictions on how user agents or distribution lists process DSNs they receive ๐Ÿซถ

4. Security Considerations ๐Ÿ”

Bestie, the security section is SERIOUS ๐Ÿ˜ญ These considerations apply when using DSNs:

4.1. Forgery ๐ŸŽญ

DSNs can be forged just as easily as ordinary Internet email ๐Ÿ’€ User agents and automatic mail handling facilities (like mailing list exploders) that want to automatically use DSNs SHOULD take appropriate precautions to minimize the potential damage from denial-of-service attacks ๐Ÿ›ก๏ธ

Security threats related to forged DSNs include sending:

  • (a) A falsified delivery notification when the message is NOT delivered to the indicated recipient ๐Ÿ˜ฑ
  • (b) A falsified non-delivery notification when the message was actually delivered to the indicated recipient ๐Ÿ˜ค
  • (c) A falsified Final-Recipient address ๐ŸŽญ
  • (d) A falsified Remote-MTA identification ๐Ÿ•ต๏ธโ€โ™€๏ธ
  • (e) A falsified relay notification when the message is "dead ended" โ˜ ๏ธ
  • (f) Unsolicited DSNs ๐Ÿ“ญ

4.2. Confidentiality ๐Ÿคซ

Another part of security is confidentiality ๐Ÿ”’ Sometimes a message recipient autoforwards their messages but doesn't want to reveal the address they're forwarded to ๐Ÿ™ˆ That desire for confidentiality will probably get stronger as "wireless mailboxes", like pagers, become more popular as autoforward addresses ๐Ÿ“Ÿ

MTA authors are encouraged to provide a mechanism that lets the end user keep a forwarding address confidential ๐Ÿงโ€โ™€๏ธ Depending on how confidential it needs to be, and the environment the message is forwarded into, this might be done with one or more of these:

  • (a) Issuing a "relayed" DSN (if a positive DSN was requested) when a message gets forwarded to a confidential forwarding address, and disabling requests for positive DSNs for the forwarded message ๐Ÿฆ‹
  • (b) Declaring the message delivered, issuing a "delivered" DSN, re-sending the message to the confidential forwarding address, and arranging for NO DSNs to be issued for the re-sent message ๐ŸŽ€
  • (c) Omitting "Remote-*" or extension fields of a DSN whenever they would otherwise contain confidential information (like a confidential forwarding address) ๐Ÿ™Š
  • (d) For messages forwarded to a confidential address, setting the envelope return address (e.g., SMTP MAIL FROM address) to the NULL reverse-path ("<>") so that no DSNs would be sent from a downstream MTA to the original sender ๐Ÿซฅ
  • (e) For messages forwarded to a confidential address, disabling delivery notifications for the forwarded message (e.g., if the "next-hop" MTA uses ESMTP and supports the DSN extension, by using the NOTIFY=NEVER parameter to the RCPT command) ๐Ÿ”•
  • (f) When forwarding mail to a confidential address, having the forwarding MTA rewrite the envelope return address for the forwarded message and attempt delivery as if the forwarding MTA were the originator ๐Ÿช„ When it gets the final delivery status, the forwarding MTA would issue a DSN to the original sender ๐Ÿ“จ

In general, any optional DSN field MAY be omitted if the Reporting MTA site decides that including the field would compromise site confidentiality too much ๐Ÿง  That need for confidentiality has to be balanced against how useful the omitted info is in trouble reports and in DSNs gatewayed to foreign environments โš–๏ธ

Heads up, implementers ๐Ÿšจ Lots of existing MTAs send non-delivery notifications to a return address in the message header (instead of the one in the envelope), which violates SMTP and other protocols ๐Ÿ˜ค If a message goes through one of those MTAs, no reasonable action by the forwarding MTA can stop the downstream MTA from compromising the forwarding address ๐Ÿ˜ฉ Similarly, if the recipient's MTA automatically responds to messages based on a request in the message header (like the nonstandard but widely used Return-Receipt-To extension header), it will also compromise the forwarding address ๐Ÿ™ƒ

4.3. Non-Repudiation ๐Ÿ“

Within today's internet mail framework, the DSNs defined in this memo give mail users valuable info ๐Ÿ’– However, even a "failed" DSN can NOT be relied on as a guarantee that a message was not received by the recipient ๐Ÿ™…โ€โ™€๏ธ Even when DSNs aren't actively forged, there are conditions where a message can be delivered even though a failure DSN was issued ๐Ÿ˜ฌ

For example, a race condition in SMTP allows message duplication if the connection drops after a completed DATA command but before the SMTP client sees a response ๐Ÿƒโ€โ™€๏ธ

This will cause the SMTP client to retransmit the message, even though the SMTP server has already accepted it [SMTPDUP] ๐Ÿ” If one of those delivery attempts succeeds and the other one fails, a "failed" DSN could be issued even though the message actually reached the recipient ๐Ÿ’€

5. Normative References ๐Ÿ“š

  • [DRPT] Moore, K., "SMTP Service Extension for Delivery Status Notifications", RFC 3461, January 2003. ๐Ÿ’Œ
  • [DSN] Moore, K. and G. Vaudreuil, "An Extensible Message Format for Delivery Status Notifications", RFC 1894, January 1996. ๐Ÿ“„
  • [HOSTREQ] Braden, R. (ed.), "Requirements for Internet Hosts - Application and Support", STD 3, RFC 1123, October 1989. ๐Ÿ–ฅ๏ธ
  • [MIME1] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996. ๐Ÿงฉ
  • [MIME3] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text", RFC 2047, November 1996. ๐ŸŒ
  • [REPORT] Vaudreuil, G., "The Multipart/Report Content Type for the Reporting of Mail System Administrative Messages", RFC 3462, January 2003. ๐Ÿ“Š
  • [RFC822] Crocker, D., "Standard for the format of ARPA Internet Text Messages", STD 11, RFC 822, August 1982. ๐Ÿ•ฐ๏ธ
  • [SMTP] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821, August 1982. ๐Ÿ“ฎ
  • [SMTPDUP] Partridge, C., "Duplicate Messages and SMTP", RFC 1047, February 1988. ๐Ÿ”‚
  • [STATUS] Vaudreuil, G., "Enhanced Mail System Status Codes", RFC 3463, January 2003. ๐Ÿท๏ธ
  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. ๐Ÿ”‘

6. Acknowledgments ๐Ÿซถ

The authors wish to thank the following people for their reviews of early drafts of RFC 1894, of which this document is a revision, and for their suggestions for improvement: Eric Allman, Harald Alvestrand, Allan Cargille, Jim Conklin, Peter Cowen, Dave Crocker, Roger Fajman, Ned Freed, Marko Kaittola, Steve Kille, John Klensin, John Gardiner Myers, Mark Nahabedian, Julian Onions, Jacob Palme, Jean Charles Roy, and Gregory Sheehan. ๐Ÿ’œ

Appendix A - collected grammar โœจ

okay bestie, this is the cheat sheet ๐Ÿ“‹ all the grammar in one place so you don't have to hunt through the whole doc. quick heads up: the lexical tokens atom, CHAR, comment, CR, CRLF, DIGIT, LF, linear-white-space, SPACE, and text are borrowed from RFC 822 ๐ŸŽ€, and the date-time token comes from [HOSTREQ] ๐Ÿ’–

action-field = "Action" ":" action-value

action-value =  "failed" / "delayed" / "delivered"
      / "relayed" / "expanded"

address-type = atom

arrival-date-field = "Arrival-Date" ":" date-time

delivery-status-content =  per-message-fields
      1*( CRLF per-recipient-fields )

diagnostic-code-field =  "Diagnostic-Code" ":"
      diagnostic-type ";" *text

diagnostic-type = atom

dsn-gateway-field = "DSN-Gateway" ":" mta-name-type ";" mta-name

envelope-id = *text

extension-field = extension-field-name ":" *text

extension-field-name = atom

final-recipient-field =
      "Final-Recipient" ":" address-type ";" generic-address

final-log-id-field = "Final-Log-ID" ":" *text

generic-address = *text

last-attempt-date-field = "Last-Attempt-Date" ":" date-time

mta-name = *text

mta-name-type = atom

original-envelope-id-field =
      "Original-Envelope-Id" ":" envelope-id

original-recipient-field =
      "Original-Recipient" ":" address-type ";" generic-address

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 ]
      *( extension-field CRLF )

per-recipient-fields =
     [ original-recipient-field CRLF ]
     final-recipient-field CRLF
     action-field CRLF
     status-field CRLF
     [ remote-mta-field CRLF ]
     [ diagnostic-code-field CRLF ]
     [ last-attempt-date-field CRLF ]
     [ final-log-id-field CRLF ]
     [ will-retry-until-field CRLF ]
     *( extension-field CRLF )

received-from-mta-field =
     "Received-From-MTA" ":" mta-name-type ";" mta-name

remote-mta-field =
     "Remote-MTA" ":" mta-name-type ";" mta-name

reporting-mta-field =
      "Reporting-MTA" ":" mta-name-type ";" mta-name

status-code = DIGIT "." 1*3DIGIT "." 1*3DIGIT

  ; White-space characters and comments are NOT allowed within a
  ; a status-code, though a comment enclosed in parentheses
  ; MAY follow the last numeric sub-field of the status-code.
  ; Each numeric sub-field within the status-code MUST be
  ; expressed without leading zero digits.

status-field = "Status" ":" status-code

will-retry-until-field = "Will-Retry-Until" ":" date-time

Appendix B - Guidelines for gatewaying DSNs ๐Ÿฆ‹

NOTE: this part is a bunch of non-binding recommendations ๐ŸŒธ for mail gateways that want to give semi-transparent delivery reports between the Internet and some other electronic mail system. If a particular pair of mail systems needs its own DSN gateway rules, other documents can define those ๐Ÿ’œ

Gatewaying from other mail systems to DSNs

so a mail gateway can send a DSN to pass along the contents of a "foreign" delivery or non-delivery notification over Internet mail ๐Ÿ“ฌ If the foreign notification elements map nicely onto DSN fields, the info can go in those fields. Extra stuff (the kind you'd want for a trouble ticket, or to tunnel the foreign notification through the Internet) can go in extension DSN fields ๐ŸŽ€ Those should get names that identify the foreign mail protocol, like X400-* for X.400 NDN or DN protocol elements.

The gateway MUST try to supply reasonable values for the Reporting-MTA, Final-Recipient, Action, and Status fields ๐Ÿ”ฅ Usually these come from translating the values in the remote delivery or non-delivery notification into their Internet-style versions. Some info loss is totally normal though ๐Ÿฅฒ For example, the DSN status-codes might not be enough to fully describe the foreign diagnostic code. So the gateway should pick the most precise code that describes the failure, and fall back on the "generic" codes 2.0.0 (success), 4.0.0 (temporary failure), and 5.0.0 (permanent failure) when it has to โœจ The actual foreign diagnostic code should be kept in the Diagnostic-Code field (with a suitable diagnostic-type value) for trouble tickets or tunneling ๐Ÿ’…

The sender-specified recipient address, plus the original envelope-id if the foreign transport envelope had one, should be kept in the Original-Recipient and Original-Envelope-ID fields ๐Ÿ’–

The gateway should also try to keep the "final" recipient addresses and MTA names from the foreign system ๐Ÿงš Whenever it's possible, foreign protocol elements should be encoded as meaningful printable ASCII strings ๐ŸŒˆ

For DSNs made from foreign delivery or non-delivery notifications, the name of the gateway MUST show up in the DSN's DSN-Gateway field ๐Ÿซถ

Gatewaying from DSNs to other mail systems

it may be possible to gateway DSNs from the Internet into a foreign mail system ๐ŸŒ The main goal is to share delivery status info in a form the destination system can actually use โœจ A secondary goal is letting DSNs "tunnel" through foreign mail systems, so they can be gatewayed back into the Internet later on ๐Ÿฆ‹

In general, the DSN recipient (aka the sender of the original message) will want to know three things for each recipient ๐Ÿ‘‘: the closest available approximation to the original recipient address, the delivery status (success, failure, or temporary failure), and for failed deliveries, a diagnostic code that explains why it failed ๐Ÿ’€

If possible, the gateway should try to keep the Original-Recipient address and Original-Envelope-ID (if present) in the resulting foreign delivery status report ๐Ÿ“

When reporting delivery failures, if the diagnostic-type sub-field of the Diagnostic-Code field says the original diagnostic code is understood by the destination environment, then the info from the Diagnostic-Code field should be used ๐Ÿ™ˆ If that doesn't work, the info in the Status field should get mapped to the closest available diagnostic code the destination environment uses ๐ŸŒธ

If it's possible to tunnel a DSN through the destination environment, the gateway specification may define a way to keep the DSN info in the delivery status reports that environment uses ๐Ÿ’œ

Appendix C - Guidelines for use of DSNs by mailing list exploders ๐Ÿ“ฎ

this section is only about how DSNs get used by "mailing lists," as defined in [4], section 7.2.7 ๐Ÿ’…

DSNs are built so mailing list exploders can spot and automatically delete recipients whose mail keeps failing ๐Ÿ”ฅ

When a list forwards a message to subscribers, the exploder should always set the envelope return address (for example the SMTP MAIL FROM address) to point to a special address that's set up to receive non-delivery reports ๐Ÿ“ฌ A "smart" exploder can then grab those reports, and if they're in DSN format, check them automatically to see which recipients had a delivery fail or get delayed ๐Ÿง 

The Original-Recipient field should be used if it's available, since it should match the subscriber address the list already knows exactly ๐ŸŽ€ If there's no Original-Recipient field, the recipient field might look like the list subscriber address. But a subscriber often forwards their mail to a different address, or the address might get rewritten, so the exploder may need heuristics to match an address from the recipient field ๐Ÿ™ƒ Be careful here and keep false matches to a minimum โš ๏ธ

The reason for a delivery failure can come from the Status and Action fields, and from the Diagnostic-Code field (if the status-type is recognized) ๐Ÿ” Reports for recipients with action values other than "failed" can usually be ignored. Most importantly, subscribers should not be removed from a list because of "delayed" reports ๐Ÿซถ

Here's the tea ๐Ÿต: almost any failure status code, even a "permanent" one, can come from a temporary condition ๐Ÿฅน So it is recommended that a list exploder does not delete a subscriber based on any single failure DSN (no matter the status code). It should only delete based on delivery failure that keeps going over a period of time ๐Ÿ’–

Some failures are less likely than others to be caused by temporary conditions, though, and some failures get noticed and fixed faster than others ๐Ÿ‘‘ Once more precise status codes are defined, it might help to tell them apart when deciding whether to delete a subscriber ๐ŸŒˆ For example, on a list with a lot of traffic, it might be smarter to temporarily pause delivery to a recipient address that keeps getting "temporary" failures, instead of just deleting it ๐Ÿฆ‹ How long the pause lasts could depend on the type of error โณ On the other hand, a "user unknown" error that sticks around for several days could be a pretty reliable sign the address is no longer valid ๐Ÿ’€

Appendix D - IANA registration forms for DSN types ๐ŸŽ€

these forms are for registering a new address-type, diagnostic-type, or MTA-name-type with the Internet Assigned Numbers Authority (IANA) ๐Ÿงš Every piece of info a form asks for can be provided on the form itself, or by pointing to a published, publicly available specification that has the info ๐Ÿ“š IANA MAY reject DSN type registrations because the form is incomplete, the specs are imprecise, or the type names are inappropriate ๐Ÿ™…โ€โ™€๏ธ

To register a DSN type, fill out the right form below and send it by Internet electronic mail to <IANA@IANA.ORG> ๐Ÿ’Œ

IANA registration form for address-type

A registration for a DSN address-type MUST include the following info โœจ

  • (a) The proposed address-type name.
  • (b) The syntax for mailbox addresses of this type, written in BNF, regular expressions, ASN.1, or another non-ambiguous language.
  • (c) If addresses of this type aren't made up entirely of graphic characters from the US-ASCII repertoire, a spec for how they should be encoded as graphic US-ASCII characters in a DSN Original-Recipient or Final-Recipient DSN field ๐ŸŒธ
  • (d) [optional] A spec for how addresses of this type get translated to and from Internet electronic mail addresses ๐Ÿฆ‹

IANA registration form for diagnostic-type

A registration for a DSN address-type MUST include the following info ๐Ÿ’œ

  • (a) The proposed diagnostic-type name.
  • (b) A description of the syntax used to express diagnostic codes of this type as graphic characters from the US-ASCII repertoire ๐Ÿ”ค
  • (c) A list of valid diagnostic codes of this type, plus what each code means ๐Ÿ“‹
  • (d) [optional] A spec for mapping diagnostic codes of this type to DSN status codes (as defined in [5]) ๐ŸŒˆ

IANA registration form for MTA-name-type

Okay bestie, if you want to register a DSN MTA-name-type ๐ŸŽ€ you need to bring the right info. A registration for a DSN MTA-name-type must include the following information:

  • (a) The proposed MTA-name-type name.
  • (b) A description of the syntax of MTA names of this type, using BNF, regular expressions, ASN.1, or other non-ambiguous language.
  • (c) If MTA names of this type do not consist entirely of graphic characters from the US-ASCII repertoire, a specification for how an MTA name of this type should be expressed as a sequence of graphic US-ASCII characters.

Appendix E - Examples ๐Ÿงš

These examples are provided as illustration only, and are not considered part of the DSN protocol specification. If an example conflicts with the protocol definition above, the example is wrong.

Real talk: if an example and the protocol disagree, the example loses. Always. ๐Ÿ™…โ€โ™€๏ธ

Likewise, the use of *-type sub-field names or extension fields in these examples is not to be construed as a definition for those type names or extension fields. So don't read a made-up field in an example as official. ๐Ÿ’…

These examples were manually translated from bounced messages using whatever information was available. Translation is messy, bestie, so expect some vibes. ๐ŸŒธ

Simple DSN

This is a simple DSN issued after repeated attempts to deliver a message failed. In this case, the DSN is issued by the same MTA from which the message was originated. Classic lowkey tragic moment. ๐Ÿ˜ญ

Date: Thu, 7 Jul 1994 17:16:05 -0400 From: Mail Delivery Subsystem
<MAILER-DAEMON@CS.UTK.EDU> Message-Id:
<199407072116.RAA14128@CS.UTK.EDU> Subject: Returned mail: Cannot
send message for 5 days To: <owner-info-mime@cs.utk.edu> MIME-
Version: 1.0 Content-Type: multipart/report; report-type=delivery-
status;
       boundary="RAA14128.773615765/CS.UTK.EDU"

--RAA14128.773615765/CS.UTK.EDU

The original message was received at Sat, 2 Jul 1994 17:10:28 -0400
from root@localhost

    ----- The following addresses had delivery problems -----
<louisl@larry.slip.umd.edu>  (unrecoverable error)

----- Transcript of session follows -----
<louisl@larry.slip.umd.edu>... Deferred: Connection timed out
            with larry.slip.umd.edu.
Message could not be delivered for 5 days
Message will be deleted from queue

--RAA14128.773615765/CS.UTK.EDU
content-type: message/delivery-status

Reporting-MTA: dns; cs.utk.edu

Original-Recipient: rfc822;louisl@larry.slip.umd.edu
Final-Recipient: rfc822;louisl@larry.slip.umd.edu
Action: failed
Status: 4.0.0
Diagnostic-Code: smtp; 426 connection timed out
Last-Attempt-Date: Thu, 7 Jul 1994 17:15:49 -0400

--RAA14128.773615765/CS.UTK.EDU
content-type: message/rfc822

[original message goes here]

--RAA14128.773615765/CS.UTK.EDU--

Multi-Recipient DSN

This is another DSN issued by the sender's MTA, which contains details of multiple delivery attempts. Some of these were detected locally, and others by a remote MTA. Multiple recipients, multiple vibes. ๐Ÿฆ‹

Date: Fri, 8 Jul 1994 09:21:47 -0400
From: Mail Delivery Subsystem <MAILER-DAEMON@CS.UTK.EDU>
Subject: Returned mail: User unknown
To: <owner-ups-mib@CS.UTK.EDU>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
       boundary="JAA13167.773673707/CS.UTK.EDU"

--JAA13167.773673707/CS.UTK.EDU
content-type: text/plain; charset=us-ascii

       ----- The following addresses had delivery problems -----
<arathib@vnet.ibm.com> (unrecoverable error)
<wsnell@sdcc13.ucsd.edu> (unrecoverable error)

 --JAA13167.773673707/CS.UTK.EDU
content-type: message/delivery-status

Reporting-MTA: dns; cs.utk.edu

Original-Recipient: rfc822;arathib@vnet.ibm.com
Final-Recipient: rfc822;arathib@vnet.ibm.com
Action: failed
Status: 5.0.0 (permanent failure)
Diagnostic-Code: smtp;  550 'arathib@vnet.IBM.COM' is not a
 registered gateway user
Remote-MTA: dns; vnet.ibm.com

Original-Recipient: rfc822;johnh@hpnjld.njd.hp.com
Final-Recipient: rfc822;johnh@hpnjld.njd.hp.com
Action: delayed
Status: 4.0.0 (hpnjld.njd.jp.com: host name lookup failure)

Original-Recipient: rfc822;wsnell@sdcc13.ucsd.edu
Final-Recipient: rfc822;wsnell@sdcc13.ucsd.edu
Action: failed
Status: 5.0.0
Diagnostic-Code: smtp; 550 user unknown
Remote-MTA: dns; sdcc13.ucsd.edu

--JAA13167.773673707/CS.UTK.EDU
content-type: message/rfc822

 [original message goes here]

--JAA13167.773673707/CS.UTK.EDU--

DSN from gateway to foreign system

A delivery report generated by Message Router (MAILBUS) and gatewayed by PMDF_MR to a DSN. In this case the gateway did not have sufficient information to supply an original-recipient address. Gateways really be doing their best. ๐ŸŒˆ

Disclose-recipients: prohibited
Date: Fri, 08 Jul 1994 09:21:25 -0400 (EDT)
From: Message Router Submission Agent <AMMGR@corp.timeplex.com>
Subject: Status of: Re: Battery current sense
To: owner-ups-mib@CS.UTK.EDU
Message-id: <01HEGJ0WNBY28Y95LN@mr.timeplex.com>
MIME-version: 1.0
content-type: multipart/report;
    report-type=delivery-status;
    boundary="84229080704991.122306.SYS30"

--84229080704991.122306.SYS30
content-type: text/plain

Invalid address - nair_s
%DIR-E-NODIRMTCH, No matching Directory Entry
Entry found

--84229080704991.122306.SYS30
content-type: message/delivery-status

Reporting-MTA: mailbus; SYS30

Final-Recipient: unknown; nair_s
Status: 5.0.0 (unknown permanent failure)
Action: failed

--84229080704991.122306.SYS30--

Delayed DSN

A delay report from a multiprotocol MTA. Note that there is no returned content, so no third body part appears in the DSN. No original message attached this time, so the report is just the vibes. ๐Ÿซถ

MIME-Version: 1.0
From: <postmaster@nsfnet-relay.ac.uk>
Message-Id: <199407092338.TAA23293@CS.UTK.EDU>
Received: from nsfnet-relay.ac.uk by sun2.nsfnet-relay.ac.uk
        id <g.12954-0@sun2.nsfnet-relay.ac.uk>;
        Sun, 10 Jul 1994 00:36:51 +0100
To: owner-info-mime@cs.utk.edu
Date: Sun, 10 Jul 1994 00:36:51 +0100
Subject: WARNING: message delayed at "nsfnet-relay.ac.uk"
content-type: multipart/report; report-type=delivery-status;
       boundary=foobar

--foobar
content-type: text/plain

The following message:

UA-ID: Reliable PC (...
Q-ID: sun2.nsf:77/msg.11820-0

has not been delivered to the intended recipient:

    thomas@de-montfort.ac.uk

despite repeated delivery attempts over the past 24 hours.

The usual cause of this problem is that the remote system is
temporarily unavailable.

Delivery will continue to be attempted up to a total elapsed time of
168 hours, i.e., 7 days.

You will be informed if delivery proves to be impossible within this
time.

Please quote the Q-ID in any queries regarding this mail.

--foobar
content-type: message/delivery-status

Reporting-MTA: dns; sun2.nsfnet-relay.ac.uk

Final-Recipient: rfc822;thomas@de-montfort.ac.uk
Status: 4.0.0 (unknown temporary failure)
Action: delayed

--foobar--

Appendix F - Changes from RFC 1894 ๐Ÿ“

Here's the glow-up tea from RFC 1894. โœจ The changes were:

  • Changed Authors contact information
  • Updated required standards boilerplate
  • Edited the text to make it spell-checker and grammar checker compliant
  • Updated references to point to later, more mature documents, changed reference enumeration scheme.
  • Fixed paragraph numbering on page 20
  • Fixed Delayed DSN example
  • Added Table of Contents
  • Moved Appendices to the end of the document
  • Changed the MTA-name-Type for gateways into Internet mail, the MTA-name-type from "SMTP" to "dns".

Authors' Addresses ๐Ÿฆ‹

Keith Moore
University of Tennessee
1122 Volunteer Blvd, Suite 203
Knoxville TN 37996-3450
USA

Phone: +1-865-974-3126
Fax:   +1-865-974-8296
EMail: moore@cs.utk.edu


Gregory M. Vaudreuil
Lucent Technologies
7291 Williamson Rd
Dallas, Tx. 75214
USA

Phone: +1 214 823 9325
EMail: GregV@ieee.org

Copyright (C) The Internet Society (2003). 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. Thank you, Internet Society, you're literally keeping the lights on. โœจ

๐Ÿ“ฆ where this page comes from