Network Working Group                                        Keith Moore
Internet-Draft                                   University of Tennessee
Expires: 12 September 1995                                 12 March 1995


                         SMTP Service Extension
                   for Delivery Status Notifications

                   draft-ietf-notary-smtp-drpt-03.txt


1. Status of this Memo

   This document is an Internet-Draft.  Internet-Drafts are working
documents of the Internet Engineering Task Force (IETF), its areas, and
its working groups.  Note that other groups may also distribute working
documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time.  It is not appropriate to use Internet-Drafts as reference
material or to cite them other than as ``work in progress.''

   To learn the current status of any Internet-Draft, please check the
``1id-abstracts.txt'' listing contained in the Internet- Drafts Shadow
Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
ftp.isi.edu (US West Coast).


2. Abstract

   This memo defines an extension to the SMTP service, which allow an
SMTP client to specify (a) that delivery status notifications (DSNs)
should be generated under certain conditions, (b) whether such
notifications should return the contents of the message, and (c)
additional information, to be returned with a DSN, that allows the
sender to identify both the recipient(s) for which the DSN was issued,
and the transaction in which the original message was sent.


3. Introduction

   The SMTP protocol [1] requires that an SMTP server provide
notification of delivery failure, if it determines that a message cannot
be delivered to one or more recipients.  Traditionally, such
notification consists of an ordinary Internet mail message (format
defined by [2]), sent to the envelope sender address (the argument of
the SMTP MAIL command), containing an explanation of the error and at
least the headers the failed message.

   Experiences with large mail distribution lists [3] indicates that
such messages are often insufficient to diagnose problems, or even to
determine at which host or for which recipients a problem occurred.  In
addition, the lack of a standardized format for delivery notifications



K. Moore                Expires 12 September 1995               [Page 1]


SMTP Delivery Status Notifications                         12 March 1995



in Internet mail makes it difficult to exchange such notifications with
other message handling systems.

   Such experience has demonstrated a need for a delivery status
notification service for Internet electronic mail, which:

(a) is reliable, in the sense that any DSN request will either be
    honored at the time of final delivery, or result in a response that
    indicates that the request cannot be honored,

(b) should result in exactly one response for any particular sender-
    specified recipient,

(c) is stable, in that a DSN should never be issued in response to a
    DSN,

(d) preserves sufficient information to allow the sender to identify
    both the mail transaction and the recipient address which caused the
    notification, even when mail is forwarded or gatewayed to foreign
    environments, and

(e) interfaces acceptably with non-SMTP and non-822-based mail systems,
    both so that notifications returned from foreign mail systems may be
    useful to Internet users, and so that the notification requests from
    foreign environments may 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.

   In an attempt to provide such a service, this memo uses the mechanism
defined in [4] to define an extension to the SMTP protocol.  Using this
mechanism, an SMTP client may request that an SMTP server issue or not
issue a delivery status notification (DSN) under certain conditions.
The format of a DSN is defined in [5].


4. Framework for the Delivery Status Notification Extension

   The following service extension is therefore defined:

(1) The name of the SMTP service extension is "Delivery Status
    Notification";

(2) the EHLO keyword value associated with this extension is "DSN", the
    meaning of which is defined in section 5 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:




K. Moore                Expires 12 September 1995               [Page 2]


SMTP Delivery Status Notifications                         12 March 1995



    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 6.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 6.2, and

    An optional parameter for the MAIL command, using the esmtp-keyword
    "RET", (to request that DSNs either return or not return the
    contents of a message), is defined in section 6.3,

    An optional parameter for the MAIL command, using the esmtp-keyword
    "ENVID", (used to propagate a sender-specified unique identifier for
    this envelope, to be returned in a DSN), is defined in section 6.4;

(5) no additional SMTP verbs are defined by this extension.

   The remainder of this memo specifies how support for the extension
affects the behavior of a message transfer agent.


5.  The Delivery Status Notification service extension

   An SMTP client wishing to request a DSN for a message may issue the
EHLO command to start an SMTP session, to determine if the server
supports any of several service extensions.  If the server responds with
code 250 to the EHLO command, and the response includes the EHLO keyword
DSN, then the Delivery Status Notification extension (as described in
this memo) is supported.

   Ordinarily, when an SMTP server returns a positive (2xx) reply code
in response to a RCPT command, it agrees to accept responsibility for
either delivering the message to the named recipient, or sending a
notification to the sender of the message indicating that delivery has
failed.  However, an extended SMTP ("ESMTP") server which implements
this service extension will accept an optional NOTIFY parameter with the
RCPT command. If present, the NOTIFY parameter alters the default
conditions for generation of delivery status notifications from the
default (issue notifications only on failure) specified in [1].  The
ESMTP client may also request (via the RET parameter) whether the entire
contents of the original message should be returned (as opposed to just
the headers of that message), along with the DSN.

   In general, an ESMTP server which implements this service extension
will propagate delivery status notification requests when relaying mail
to other SMTP-based MTAs which also support this extension, and make a
"best effort" to ensure that such requests are honored when messages are
passed into other environments.





K. Moore                Expires 12 September 1995               [Page 3]


SMTP Delivery Status Notifications                         12 March 1995



   In order that any delivery status notifications thus generated will
be meaningful to the sender, any ESMTP server which supports this
extension will attempt to propagate the following information to any
other MTAs that are 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, the addresses will be different if the
    message was forwarded from the sender-specified address to another
    address, or the message originated in a foreign environment that
    does not use Internet electronic mail addresses.

(b) for the entire SMTP transaction, an envelope identification string,
    which may be used by the sender to associate any delivery status
    notifications with the transaction used to send the original
    message.


6.  Additional parameters for RCPT and MAIL commands

   The extended RCPT and MAIL commands are issued by a client when it
wishes to request a DSN from the server, under certain conditions, for a
particular recipient.  The extended RCPT and MAIL commands are 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].


6.1.  The NOTIFY parameter of the ESMTP RCPT command

   A RCPT command issued by a client may contain the optional esmtp-
keyword "NOTIFY", to specify 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.



K. Moore                Expires 12 September 1995               [Page 4]


SMTP Delivery Status Notifications                         12 March 1995



c. Although RFC 822 ABNF syntax is used, white space MUST NOT be
   transmitted within an notify-esmtp-value, and RFC 822 style comments
   MUST NOT appear in NOTIFY parameter values.

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

+ An NOTIFY parameter value of "NEVER" requests that a DSN not be issued
  under any conditions.

+ A NOTIFY parameter value containing the "SUCCESS" or "FAILURE"
  keywords requests that a DSN be issued on successful delivery or
  delivery failure, respectively.

+ A NOTIFY parameter value containing the keyword "DELAY" indicates the
  sender's willingness to received "delayed" DSNs.  Delayed DSNs may be
  issued if delivery of a message has been delayed for an unusual amount
  of time (as determined by the MTA at which the message is delayed),
  but the final delivery status (whether successful or failure) cannot
  be determined.  The absence of the DELAY keyword in a NOTIFY parameter
  requests that a "delayed" DSN NOT be issued under any conditions.

The actual rules governing interpretation of the NOTIFY parameter are
given in section 7.

If the NOTIFY parameter is not included in a RCPT command, the SMTP
server should issue notifications for that recipient only if the message
cannot be delivered, as specified in [1].


6.2 The ORCPT parameter to the ESMTP RCPT command

   The ORCPT esmtp-keyword of the RCPT command is used to specify an
"original" recipient address that corresponds to the actual recipient to
which the message is to be delivered.  If the ORCPT esmtp-keyword is
used, it MUST have an associated esmtp-value, which consists of the
original recipient address, encoded according to the rules below.  The
ABNF for the ORCPT parameter is:

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

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

   where "addr-type" and "xtext" are defined in [5].  "addr-type" must
be an IANA-registered electronic mail address type, while "xtext"
contains a representation of the original recipient address, encoded
according to the rules for "xtext" in [5].

   NOTE: The syntax for "esmtp-value" in [4] does not allow SP, "=",
control characters, or non-ASCII characters to be transmitted in an
esmtp-value.  If any of these characters appear in the original
recipient address, their octet values must be encoded in hexadecimal



K. Moore                Expires 12 September 1995               [Page 5]


SMTP Delivery Status Notifications                         12 March 1995



according to the rules for "xtext".

Because a message may have originated in a foreign environment that does
not use Internet-style electronic mail addresses, the esmtp-value
associated with the ORCPT keyword is NOT constrained to conform to
syntax rules for Internet addresses.  Instead, the "addr-type" portion
of the original-recipient-address is used to identify the "type" of
address which appears in the ORCPT parameter value.

   Ideally, the "xtext" portion of the original-recipient-address should
contain, in encoded form, the same sequence of characters that the
sender used to specify the recipient.  However, for a message gatewayed
from an environment (such as X.400) in which a recipient address is not
a simple string of printable characters, the ORCPT parameter should
contain a printable representation of the recipient address that is
likely to be recognized by the sender.


6.2 The RET parameter of the ESMTP MAIL command

   The RET esmtp-keyword on the extended MAIL command specifies whether
or not the message should be included in any DSN issued for this message
transmission.  If the RET esmtp-keyword is used, it MUST have an
associated esmtp-value, which is one of the following keywords:

FULL  requests that the entire message be returned in any delivery
      status notification issued for this recipient.
HDRS  requests that only the headers of the message be returned.


6.3  The ENVID parameter to the ESMTP MAIL command

   The ENVID esmtp-keyword of the SMTP MAIL command is used to specify
an "envelope identifier" to be transmitted along with the message and
included in any DSNs issued for any of the recipients named in this SMTP
transaction.  The purpose of the envelope identifier is to allow the
sender of a message to identify the transaction for which the DSN was
issued.

   The ABNF for the ENVID parameter is:

     envid-parameter = "ENVID=" xtext

   The ENVID esmtp-keyword MUST have an associated esmtp-value.  No
meaning is assigned by the mail system to the presence or absence of
this parameter or to any esmtp-value associated with this parameter; the
information is used only by the sender or his user agent.







K. Moore                Expires 12 September 1995               [Page 6]


SMTP Delivery Status Notifications                         12 March 1995



6.4 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 of these parameters
appears 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 of these parameters appears in
a RCPT command, the ESMTP server SHOULD respond with "501 syntax error
in parameters or arguments".


7. Conformance requirements

   The Simple Message Transfer Protocol (SMTP) is used by both Message
Transfer Agents (MTAs) when accepting, relaying, or gatewaying mail, as
well as User Agents (UAs) when submitting mail to the mail transport
system.  The DSN extension to SMTP may be used to allow UAs to convey
the sender's requests as to when DSNs should be issued.  A UA which
claims to conform to this specification must meet certain requirements
as described below.

   Typically, a message transfer agent (MTA) which supports SMTP will
assume, at different times, both the role of a SMTP client and an SMTP
server, and may also provide local delivery, gatewaying to foreign
environments, forwarding, and mailing list expansion.  An MTA which,
when acting as an SMTP server, issues the DSN keyword in response to the
EHLO command, MUST obey the rules below for a "conforming SMTP client"
when acting as a client, and a "conforming SMTP server" when acting as a
server.  The term "conforming MTA" refers to an MTA which conforms to
this specification, independent of its role of client or server.


7.1 SMTP protocol interactions

   The following rules apply to SMTP transactions in which any of the
ENVID, NOTIFY, RET, or ORCPT keywords are used:

(a) If an SMTP client issues a MAIL command containing a valid ENVID
    parameter and associated esmtp-value and/or a valid RET parameter
    and associated esmtp-value, a conforming SMTP server MUST return the
    same reply-code as it would to the same MAIL command without the
    ENVID and/or OMTS parameters.  A conforming SMTP server MUST NOT
    refuse a MAIL command based on the absence or presence of valid
    ENVID or RET parameters, or on their associated esmtp-values.

    However, if the associated esmtp-keyword is not valid (i.e. contains
    illegal characters), or if there is more than one ENVID or RET
    parameter in a particular MAIL command, the server SHOULD issue the
    response "501 syntax error in parameter".



K. Moore                Expires 12 September 1995               [Page 7]


SMTP Delivery Status Notifications                         12 March 1995



(b) If an SMTP client issues a RCPT command containing any valid NOTIFY
    and/or ORCPT parameters, a conforming SMTP server MUST return the
    same response as it would to the same RCPT command without those
    NOTIFY and/or ORCPT parameters.  A conforming SMTP server MUST NOT
    refuse a RCPT command based on the presence or absence of any of
    these parameters.

    However, if any of the associated esmtp-keywords are not valid, or
    if there is more than one of any of these parameters in a particular
    RCPT command, the server SHOULD issue the response "501 syntax error
    in parameter".


7.2. Handling of messages received via SMTP

   This section describes how a conforming MTA should handle any
messages received via SMTP.


7.2.1. Relay of messages to other conforming SMTP servers

   The following rules govern the behavior of a conforming MTA, when
relaying 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 included in the MAIL command when a message was
    received, MUST also appear on the MAIL command with which the
    message is relayed, 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 included in the MAIL command when a message was
    received, MUST also appear on the MAIL command with which the
    message is relayed, 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 no NOTIFY parameter was 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) If any ORCPT parameter was present in the RCPT command for a
    recipient when the message was received, that parameter and its
    associated value MUST appear in the RCPT command issued for that
    recipient when relaying the message.




K. Moore                Expires 12 September 1995               [Page 8]


SMTP Delivery Status Notifications                         12 March 1995



    If no ORCPT parameter was present in the RCPT command when the
    message was received, an ORCPT parameter MAY be added to the RCPT
    command when the message is relayed.  If an ORCPT parameter is added
    by the relaying MTA, it MUST contain the recipient address from the
    RCPT command used when the message was received by that MTA.


7.2.2.  Relay of messages to non-conforming SMTP servers

   The following rules govern the behavior of a conforming MTA (in the
role of client), when relaying a message which was received via the SMTP
protocol, 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.

    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.








K. Moore                Expires 12 September 1995               [Page 9]


SMTP Delivery Status Notifications                         12 March 1995



7.2.3.  Local delivery of messages

   The following rules govern the behavior of a conforming MTA upon
successful delivery of a message that was received via the SMTP
protocol, to a local recipient's mailbox:

(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 with an
    esmtp-value of NEVER, 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.


7.2.4.  Gatewaying a message into a foreign environment

   The following rules govern the behavior of a conforming MTA, when
gatewaying a message that was received via the SMTP protocol, into a
foreign (non-SMTP) environment:

(a) If the 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 either or both of the
    SUCCESS or FAILURE keywords, but the requested conditions specified
    by the associated esmtp-value cannot be met by the foreign mail
    environment, 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;



K. Moore                Expires 12 September 1995              [Page 10]


SMTP Delivery Status Notifications                         12 March 1995



    however, the MTA SHOULD attempt to honor the request using whatever
    mechanisms exist in the foreign environment.


7.2.5.  Delays in delivery

   A conforming MTA which receives a message via the SMTP protocol which
is unable to deliver or relay a message to one or more recipients for an
extended length of time (to be determined by the MTA), MAY issue a
"delayed" DSN for those recipients, under 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 which did not contain the DELAY
    keyword, a "delayed" DSN MUST NOT be issued.

NOTE: Although delay notifications are common in present-day email, 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.


7.2.6.  Failure of a conforming MTA to deliver a message

   The following rules govern the behavior of a conforming MTA which
received a message via the SMTP protocol, and is unable to deliver a
message to a recipient specified 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.

(c) If no NOTIFY parameter was supplied for the recipient, a "failure"
    DSN MUST be issued.


7.2.7.  Recipient-specified mail forwarding

   If a message intended for a particular recipient address is to be
"forwarded" to EXACTLY one recipient address:

(a) If the message is forwarded to an SMTP server that supports this



K. Moore                Expires 12 September 1995              [Page 11]


SMTP Delivery Status Notifications                         12 March 1995



    extension, any ENVID, RET, NOTIFY, and ORCPT parameters included
    with the message as received SHOULD be propagated with the forwarded
    message.

(b) If no ORCPT parameter was supplied for that recipient when the
    message was received, and the message is being forwarded to an SMTP
    server which supports this extension, the MTA SHOULD supply an ORCPT
    parameter.  If supplied, the ORCPT parameter MUST contain the
    recipient's address as it appeared in the envelope (e.g. SMTP RCPT
    command) in which the message was received.

(c) If the message is being forwarded to a non-SMTP environment, or an
    SMTP server that does not support this extension, the forwarding MTA
    should, if possible, honor the sender's requests for when delivery
    notifications should be issued by the destination environment.  If
    the sender's request for either a positive or negative delivery
    notification cannot be honored, the MTA MUST issue a "relayed"
    notification.

   If the message is to be forwarded to multiple recipient addresses on
behalf of a single recipient, and the sender has requested that positive
DSNs be issued, the MTA MUST either (a) issue a "delivered" DSN for that
recipient, and arrange that no DSNs be issued for any of the forwarding
addresses for that recipient; or (b) propagate the sender's request for
a positive and/or negative DSN to exactly one of the forwarding
addresses, and arrange that no DSNs are issued for the other recipient
addresses.

NOTE: This is intended to ensure that at most one DSN be issued per
recipient of a message.  DSNs will be difficult to use by mailing list
managers if it is possible to receive more than one notification per
recipient (e.g.  if a message were forwarded to two recipients, and
delivery succeeded for one and failed for the other).  However, it is
still possible to get both a "relayed" or "delivered" DSN and afterwards
a "failed" DSN for the same recipient, and a foreign mail system might
not issue DSNs for forwarded messages and deliveries to lists.


7.2.8.  Delivery of a message to a mailing list

   If a particular recipient address refers to a mailing list, a message
is considered to be successfully delivered to that recipient if the MTA
determines that the message is eligible to be distributed to the members
of the list.  If a NOTIFY parameter was supplied with an esmtp-value
which contains the value SUCCESS, a "delivered" DSN MUST be issued.  Any
envelope-id, original-mts-type, notify-request, return-of-content-
request, or original-recipient-address MUST NOT be propagated when
delivering a message to the recipients of that list.

   If the message is not eligible to be distributed to the list
membership (perhaps because the sender is not authorized), and either a



K. Moore                Expires 12 September 1995              [Page 12]


SMTP Delivery Status Notifications                         12 March 1995



NOTIFY parameter was supplied which contained the FAILURE keyword, or no
NOTIFY parameter was supplied, a "failed" DSN MUST be issued.


7.2.9. DSNs describing delivery to multiple recipients

   A single DSN may describe attempts to deliver a message to multiple
recipients of that message.  If a DSN is issued for some recipients in
an SMTP transaction and not for others according to the rules above, the
DSN SHOULD NOT contain information for recipients for whom DSNs would
not otherwise have been issued.


7.3. Handling of messages from other sources

   For messages which originated from "local" users (whatever that
means), the specifications under which DSNs should be generated can be
communicated to the MTA via any protocol agreed on between the sender's
mail composer (user agent) and the MTA.  The local MTA can then either
relay the message, or issue appropriate delivery status notifications.
However, if such requests are transmitted within the message itself (for
example in the message headers), the requests MUST be removed from the
message before it is transmitted via SMTP.

   For messages gatewayed from non-SMTP sources and further relayed by
SMTP, the gateway SHOULD, using the SMTP extensions described here,
attempt to provide the delivery reporting conditions expected by the
source mail environment.  If appropriate, any DSNs returned to the
source environment SHOULD be translated into the format expected in that
environment.


8.  Format of delivery notifications

   The format of delivery status notifications is defined in [5], which
uses the framework defined in [6].  Delivery status notifications are to
be returned to the sender of the original message according as outlined
below.


8.1. SMTP Envelope to be used with delivery status notifications

   The sender address (in the SMTP MAIL command) MUST be an null
reverse-path ("<>"), as required by section 5.3.3 of [7].  The recipient
address (in the RCPT command) is copied from the MAIL command which
accompanied the message for which the DSN is being issued.  When
transmitting a DSN via SMTP, the ENVID, RET, and ORCPT parameters MUST
NOT be used.  The NOTIFY parameter MAY be used, but its value must be
NEVER.





K. Moore                Expires 12 September 1995              [Page 13]


SMTP Delivery Status Notifications                         12 March 1995



8.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 generated by the mail system.  When multipart/report is
used to convey a DSN, the report-type parameter of the multipart/report
content-type is "delivery-status".

   As described in [6], 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 returned message (or only the headers).


8.3. Message/delivery-status fields

   The multipart/delivery-status content-type defines a number of
fields, with general specifications for their contents.  The following
requirements for any DSNs generated in response to a message received by
the SMTP protocol by a conforming SMTP server, are in addition to the
requirements defined in [5] for the multipart/delivery-status type.

   When generating a DSN for a message which was received via the SMTP
protocol, a conforming MTA will generate the following fields of the
multipart/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 will already
    be encoded as 'xtext', the MTA can simply copy the ENVID value to
    the Original-Envelope-ID field without further encoding.

(b) The Reporting-MTA field MUST be supplied.  It should contain the
    domain name of the SMTP server which is actually issuing this
    notification (encoded as 'xtext').  The MTA-name-type subfield
    should be "dns".

(c) Other per-message fields as 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



K. Moore                Expires 12 September 1995              [Page 14]


SMTP Delivery Status Notifications                         12 March 1995



    recipient address from the message envelope, encoded according to
    the rules for 'xtext'.  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 [8].  If
    there is no specific code which 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 subfields will be "smtp",
    and the "xtext" MUST contain the numeric SMTP reply-code received
    from the SMTP server.  The text accompanying the SMTP reply-code MAY
    appear in a comment.

(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, which contains the address of that
    recpient which was presented to the remote SMTP server.

(k) Other per-recipient fields defined in [5] MAY appear, as
    appropriate.


9. Acknowledgments

   The author wishes to thank Eric Allman, Harald Alvestrand, Jim
Conklin, Peter Cowen, Dave Crocker, Ned Freed, Steve Kille, John
Klensin, John Gardiner Myers, Julian Onions, Jacob Palme, Marshall Rose,
and Greg Vaudreuil for their suggestions for improvement of this
document.


10. Appendix - Type-Name Definitions

   The following type names are defined for use in DSN fields generated
by conforming SMTP-based MTAs:


10.1 "rfc822" address-type

   The "rfc822" address-type is to be used when reporting Internet
electronic mail address in the Original-Recipient and Final-Recipient



K. Moore                Expires 12 September 1995              [Page 15]


SMTP Delivery Status Notifications                         12 March 1995



DSN fields.  Addresses of this address-type are generally expected to be
of the form:

     [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 that are registered in the DNS.

   However, MTAs MUST NOT attempt to "correct" an address that is
reported in a DSN, even if it does not conform to the syntax rules.


10.2 "smtp" diagnostic-type

   The "smtp" diagnostic-type is to be used when reporting SMTP 3-digit
reply-codes in Diagnostic-Code DSN fields.  SMTP reply-codes are
currently defined in [1], [4], and [7].  Additional codes may be defined
by other RFCs.

   Only the 3-digit reply code is to be reported as the Diagnostic-Code.
However, any text accompanying the reply-code MAY appear as a comment
enclosed in parentheses.


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


11. Appendix - Example

   This example traces the flow of a single message addressed to
multiple recipients.  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.













K. Moore                Expires 12 September 1995              [Page 16]


SMTP Delivery Status Notifications                         12 March 1995





11.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=Bob@Big-Bucks.COM
<<< 250 <Bob@Big-Bucks.COM> recipient ok
>>> RCPT TO:<Carol@Ivory.EDU> NOTIFY=FAILURE ORCPT=Carol@Ivory.EDU
<<< 250 <Carol@Ivory.EDU> recipient ok
>>> RCPT TO:<Dana@Ivory.EDU> NOTIFY=SUCCESS,FAILURE ORCPT=Dana@Ivory.EDU
<<< 250 <Dana@Ivory.EDU> recipient ok
>>> RCPT TO:<Eric@Bombs.AF.MIL> NOTIFY=FAILURE ORCPT=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=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



















K. Moore                Expires 12 September 1995              [Page 17]


SMTP Delivery Status Notifications                         12 March 1995





11.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=Bob@Big-Bucks.COM
<<< 250 recipient okay
>>> DATA
<<< 354 send message
>>> (message goes here)
>>> .
<<< 250 message received
>>> QUIT
<<< 221 bcnu































K. Moore                Expires 12 September 1995              [Page 18]


SMTP Delivery Status Notifications                         12 March 1995





11.3 Relay to Ivory.EDU

   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=Carol@Ivory.EDU
<<< 550 error - no such recipient
>>> RCPT TO:<Dana@Ivory.EDU> NOTIFY=SUCCESS,FAILURE ORCPT=Dana@Ivory.EDU
<<< 250 recipient ok
>>> DATA
<<< 354 send message, end with '.'
>>> (message goes here)
>>> .
<<< 250 message received
>>> QUIT
<<< 221 bye


   Note that since the 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.
























K. Moore                Expires 12 September 1995              [Page 19]


SMTP Delivery Status Notifications                         12 March 1995





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
















K. Moore                Expires 12 September 1995              [Page 20]


SMTP Delivery Status Notifications                         12 March 1995





11.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 NSA.GOV support
the SMTP DSN extension.  Note that RET, ENVID, and ORCPT all retain
their original values.

<<< 220 IRS.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=George@Tax-ME.GOV
<<< 250 recipient okay
>>> DATA
<<< 354 send message
>>> (message goes here)
>>> .
<<< 250 message received
>>> QUIT
<<< 221 bcnu





























K. Moore                Expires 12 September 1995              [Page 21]


SMTP Delivery Status Notifications                         12 March 1995





11.6 Success 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: success
Status: 2.0.0

--abcde
Content-type: message/rfc822

(headers of returned message go here)

--abcde--















K. Moore                Expires 12 September 1995              [Page 22]


SMTP Delivery Status Notifications                         12 March 1995





11.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 (error - no such recipient)

--bcdef
Content-type: message/rfc822

(headers of returned message go here)

--bcdef--








K. Moore                Expires 12 September 1995              [Page 23]


SMTP Delivery Status Notifications                         12 March 1995





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








K. Moore                Expires 12 September 1995              [Page 24]


SMTP Delivery Status Notifications                         12 March 1995





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














K. Moore                Expires 12 September 1995              [Page 25]


SMTP Delivery Status Notifications                         12 March 1995





12. References

[1] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821,
    USC/Information Sciences Institute, August 1982.

[2] Crocker, D., "Standard for the Format of ARPA Internet Text
    Messages", STD 11, RFC 822, UDEL, August 1982.

[3] Westine, A., Postel, J. "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., Crocker., D.  "SMTP
    Service Extensions", RFC 1651, MCI, Innosoft, Dover Beach
    Consulting, Inc., Network Management Associates, Inc., Silicon
    Graphics, Inc., July 1994.

[5] Moore, K., Vaudreuil, G.  "An Extensible Message Format for Delivery
    Status Notifications", Internet-Draft draft-ietf-notary-mime-
    delivery-04.txt, 20 January 1995.

[6] Vaudreuil, G.  "The Multipart/Report Content Type for the Reporting
    of Mail System Administrative Messages".  Internet-Draft draft-ietf-
    notary-mime-report-01.txt, 16 January 1995.

[7] Braden, R. (ed).  Requirements for Internet Hosts - Application and
    Support, RFC 1123, IETF, October 1989.

[8] Vaudreuil, G. "Enhanced Mail System Status Codes".  Internet-Draft
    draft-ietf-notary-status-01.txt, 24 January 1995.


13. Author's address

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

email: moore@cs.utk.edu











K. Moore                Expires 12 September 1995              [Page 26]