1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
4 <!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
5 <!ENTITY RFC3461 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3461.xml">
6 <!ENTITY RFC3501 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3501.xml">
7 <!ENTITY RFC4409 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4409.xml">
8 <!ENTITY RFC4467 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4467.xml">
9 <!ENTITY RFC4468 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4468.xml">
10 <!ENTITY RFC4469 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4469.xml">
11 <!ENTITY RFC4551 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4551.xml">
12 <!ENTITY RFC5172 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5172.xml">
13 <!ENTITY RFC5228 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5228.xml">
14 <!ENTITY RFC5234 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5234.xml">
15 <!ENTITY RFC5321 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5321.xml">
16 <!ENTITY RFC5322 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5322.xml">
17 <!ENTITY RFC5550 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5550.xml">
19 <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
24 <?rfc sortrefs="yes" ?>
25 <?rfc compact="yes" ?>
26 <?rfc subcompact="no" ?>
27 <rfc category="std" docName="draft-kundrat-imap-submit-02" ipr="trust200902">
30 <title>IMAP SUBMIT Extension</title>
32 <author fullname="Jan Kundrat" initials="J." surname="Kundrat">
35 <street>Eledrova 558</street>
40 <email>jkt@flaska.net</email>
44 <date year="2013" month="August" day="27"/>
47 <workgroup>Internet Engineering Task Force</workgroup>
49 <keyword>IMAP</keyword>
50 <keyword>SMTP</keyword>
51 <keyword>ESMTP</keyword>
52 <keyword>submission</keyword>
53 <keyword>submit</keyword>
54 <keyword>sendmail</keyword>
57 <t>This document extends the IMAP protocol with a feature to submit e-mail messages for delivery. It is
58 intended to serve as a better alternative to the URLAUTH/BURL approach.</t>
63 <section title="Introduction">
64 <t>In the traditional IMAP/ESMTP service model, a MUA transfers each outgoing message twice -- once for storing
65 it in the user's "sent mail" folder, and the second time for actual message submission over (E)SMTP. Under
66 certain circumstances, such as when the message contains data which are already available in another message
67 stored on the same IMAP server (such as when forwarding an unread attachment to another recipient), the MUA
68 has to download the data before the message can be composed, resulting in transmitting the data three times
71 <t>Many proposals exist which aim to reduce this high number of transfers to the lowest possible number. The
72 CATENATE extension <xref target="RFC4469"/> enables IMAP clients to have the IMAP servers compose messages
73 on their behalf, optionally using data already available on the IMAP server. Using CATENATE, MUAs do not
74 have to download individual message parts before including them to the newly created message.</t>
76 <t>The LEMONADE extension family <xref target="RFC5550"/> mandates full support for BURL <xref
77 target="RFC4468"/> and URLAUTH <xref target="RFC4467"/> extensions. When coupled with a properly
78 configured pair of ESMTP and IMAP servers, these two extensions allow MUAs to have the submission server
79 obtain the message payload from the IMAP server. This approach completely eliminates the need to upload the
80 message data to the ESMTP server, achieving the "forward-without-download" goal.</t>
82 <t>The BURL/URLAUTH extensions, however, put a significant burden on the server operators who suddenly have to
83 establish an explicit trust relation between their submission and IMAP servers, and make this trust path
84 visible to the users' MUAs. No MUA-visible means of discovering this trust relation are defined.
85 Furthermore, the whole scheme still requires the MUAs to maintain two distinct connections speaking
86 different protocols. Users are prompted for two sets of credentials to authenticate to each of these two
87 services. Real-world support issues were reported where users are able to access their IMAP service while
88 access to the submission service is blocked by a mis-configured firewall.</t>
90 <t>The SUBMIT extension of the IMAP protocol effectively moves the message submission process to be initiated by
91 a user's request to their IMAP server. When deployed, this scenario provides a perfect discoverability to
92 the users' MUAs, saves the overhead of establishing and securing a separate TCP connection against the
93 submission server, reduces the amount of the configuration data the users are required to provide, and
94 simplifies the trust paths which are required to exist between the submission and the IMAP servers. When
95 combined with the existing CATENATE extension <xref target="RFC4469"/>, the SUBMIT command works at least as
96 effectively as the Lemonade trio of CATENATE/BURL/URLAUTH.</t>
98 <section title="Requirements Language">
99 <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
100 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
101 document are to be interpreted as described in <xref
102 target="RFC2119">RFC 2119</xref>.</t>
106 <section title="Mode of Operation">
107 <t>The SUBMIT extension adds the UID SUBMIT IMAP command which instructs the IMAP server to arrange for
108 delivery of an already existing IMAP message. How this message is composed is outside of scope of this
109 extension, but it is assumed that clients will often use the APPEND or APPEND ... CATENATE commands.</t>
111 <t>Upon receiving the SUBMIT command, the IMAP server is asked for arranging the initial message submission.
112 Clients MAY pass additional data in form of various options of the SUBMIT command (the delivery options).
113 The server checks the passed data and delivery options, optionally performs sanity checks on the message
114 contents, verifies against a local policy whether the user is authorized for message submission, and if none
115 of these checks fail, the server passes the message for subsequent delivery. The delivery method is outside
116 of scope of this document, but typical methods would be invoking a `sendmail`-compatible binary or passing
117 the message to an ESMTP gateway.</t>
120 <section title="IMAP Protocol Changes">
121 <t>This extension introduces one new IMAP command, a few related response codes and a new family of the IMAP
124 <section title="New IMAP Capabilities">
125 <section title="The SUBMIT Capability">
126 <t>Servers implementing this extension announce its presence through the SUBMIT capability. If the
127 server supports this extension but message submission is unconditionally disabled by a security
128 policy or service configuration, this capability MUST NOT be announced.</t>
129 <t>When this capability is present, clients may assume that chances are high that submitting messages
130 over IMAP will work.</t>
133 <section title="The SUBMIT= Capabilities Family">
134 <t>The SUBMIT commands issued by the IMAP clients MAY contain delivery options, and these options might
135 contain other fine grained options. Servers supporting voluntary features MUST indicate so by
136 including the appropriate strings in the CAPABILITY responses. All capabilities used for these
137 purposes begin with the SUBMIT= prefix.</t>
139 <section title="SUBMIT=DSN">
140 <t>If the server supports user control of generating the Delivery Status Notifications (DSN), it
141 MUST announce the SUBMIT=DSN capability. Clients MUST NOT attempt to control DSN options
142 through the DSN submission option unless the server announces the SUBMIT=DSN capability.</t>
147 <section title="Additional Response Codes">
148 <t>The following response codes are defined for communicating the reason why submission failed in a
149 machine-readable way.</t>
151 <section title="The POLICYDENIED Response Code">
152 <t>The POLICYDENIED response code SHOULD be used if the server rejects message submission as a result of
153 a policy based decision which MAY take the message content, submission options, user's behavior and
154 transaction history into account.</t>
155 <t>Upon seeing the POLICYDENIED response code, the client MUST inform the user that message submission
156 failed, and include the text of the response in the error message. Clients MUST NOT attempt to
157 automatically re-queue this message for sending over IMAP. The clients MAY, however, choose to
158 continue the message submission by another channel, perhaps over an ESMTP service.</t>
161 <section title="The SUBMISSIONRACE Response Code">
162 <t>The SUBMISSIONRACE response code MUST be sent in the tagged response if the client asks for
163 submission of a message that is either not marked with the $SubmitPending keyword or marked with the
164 $Submitted keyword.</t>
165 <t>The SUBMISSIONRACE response code could SHOULD have a preference over the POLICYDENIED response code.</t>
169 <section title="UID SUBMIT command">
170 <t>The UID SUBMIT command submits a message for delivery.</t>
172 <t>Arguments: <list style="symbols">
173 <t>UID of message to be sent</t>
174 <t>optional list of delivery options</t>
177 <t>Responses: FETCH response with updated message flags</t>
179 <t>Result: <list style="hanging">
180 <t hangText="OK">Message submitted for delivery</t>
181 <t hangText="NO">Submission failed</t>
182 <t hangText="BAD">Invalid commands or options</t>
185 <t>This command is only valid in the selected state.</t>
187 <t>The server MUST check its local policy configuration and verify that the authenticated user is allowed to
188 submit messages. The decision MAY be based on the user's credentials, the message contents, past
189 history of the user, or any other criteria the server deems relevant. The server SHOULD take into
190 account any other local policies before it proceeds with further submission.</t>
192 <t>Clients MUST NOT submit a message which is either not marked with the $SubmitPending keyword from <xref
193 target="RFC5550"/>, or which is marked with the $Submitted keyword. Servers MUST reject such a
194 command with a tagged NO bearing the SUBMISSIONRACE response code.</t>
196 <t>In the course of submission, servers MUST atomically add the $Submitted flag to the message, as
197 described in LEMONADE <xref target="RFC5550"/>. A transient state where the message is temporarily
198 marked with both $Submitted and $SubmitPending flags MAY be hidden from any IMAP session or it MAY be
199 visible in some or all of them.</t>
201 <t>If the command succeeded, the message MUST be marked with the $Submitted keyword, the $SubmitPending
202 keyword MUST be cleared and a FETCH response containing the message UID and its new flags MUST be
205 <t>If the command fails, the server MUST clear both the $Submitted or $SubmitPending keywords.</t>
207 <t>If the server supports CONDSTORE <xref target="RFC4551"/> or QRESYNC <xref target="RFC5172"/> extensions,
208 any flag changes MUST obey the usual MODSEQ invariants. Any changes in the MODSEQ values MUST be
209 communicated to the clients, as mandated by the relevant extensions.</t>
211 <t>Clients MUST be prepared to handle failing submission at any time. Servers MAY reject message submission
214 <t>The server MUST process all specified delivery options and their detailed options. The server MUST
215 respond with a tagged BAD if the client used unrecognized or unannounced option, or if a recognized
216 option is used in an invalid way. If the server cannot honor a recognized and announced option, it MUST
217 respond with a tagged NO with the POLICYDENIED response code and the message MUST NOT be submitted, nor
218 its flags changed.</t>
220 <t>Servers MAY alter the message payload of the outgoing message in conformance with best current practice
221 about Internet mail. Individual recipients MAY receive different versions of the message. In
222 particular, servers MUST change message headers so that the identity of addresses present in the Bcc
223 headers is not revealed to other recipients. This mode of operation is described in <xref
224 target="RFC5321"/> and <xref target="RFC5322"/>. The copy stored on the IMAP server MUST NOT be
225 altered by these modifications.</t>
227 <section title="Delivery options">
228 <t>The following two delivery options are defined by this extension. These options apply to the message
231 <section title="FROM Delivery Option">
232 <t>Syntax: one e-mail address with optional further data</t>
234 <t>The FROM delivery option corresponds to the FROM field of the SMTP envelope. If not present, its
235 value MUST be inferred from the message payload.</t>
237 <t>It is an error if the FROM delivery option is present more than once. Servers MUST reject such
238 commands using the BAD tagged response and the message MUST NOT be submitted. Message flags of
239 the source message MUST NOT be modified.</t>
241 <t>The following per-message submission option is defined by this extensions:</t>
243 <section title="DSN-ENVID Submission Option">
244 <t>Syntax: specification of ESMTP Envelope ID</t>
245 <t>This per-message submission option corresponds to the ENVID=... parameter from <xref
246 target="RFC3461"/>. It allows senders to attach a machine-readable ID to be received in the
247 delivery status reports concerning this message.</t>
248 <t>Clients MUST NOT use the DSN-ENVID return option unless the server announces the SUBMIT=DSN
249 capability or a SUBMIT=... capability defined by future extensions which make use of the ENVID
255 <section title="RECIPIENT Delivery Option">
256 <t>Syntax: one e-mail address followed by optional further data</t>
258 <t>The RECIPIENT delivery option corresponds to the RCPT TO field of the SMTP envelope.</t>
260 <t>The RECIPIENT delivery option MAY be present more than once. Servers MAY impose a limit on the
261 number of recipients of a single message.</t>
263 <t>If the RECIPIENT delivery option is present, servers MUST ignore any To, Cc and Bcc headers in
264 the message payload when determining the list of recipients of this message. That is, the final
265 list of recipients of the message MUST consist exactly of those recipients specified in the
266 RECIPIENT delivery options. The server MUST still sanitize the headers of the submitted
267 message to guarantee the privacy of the recipients listed in the Bcc message header.</t>
269 <t>If the RECIPIENT delivery option is missing, servers MUST infer its value from the message
270 payload. For example, each address present in any of To, Cc and Bcc message headers MUST be
271 present in the recipient list.</t>
273 <t>Servers MAY impose a local policy decision about always sending a copy of message to a certain
274 address. This operation MUST NOT remove any addresses from the list of recipients, as obtained
275 either from the user-specified list of recipients passed through the RECIPIENTS delivery
276 options, or inferred from the mail headers.</t>
278 <t>Message submission MUST be atomic -- message is either submitted for delivery to all recipients,
279 or it MUST NOT be submitted for delivery to anyone. Actual delivery MAY still fail for certain
280 recipients, as per usual ESMTP semantics.</t>
282 <t>The following submission options are defined for the RECIPIENT delivery option:</t>
284 <section title="DSN Submission Option">
285 <t>Syntax: delivery status notice specification</t>
286 <t>The DSN submission option controls generating of delivery status notifications related to the
287 currently submitted message. When not given, an implementation-defined default value MUST be
288 used. The default value MUST be either (FAILURE) or (DELAY, FAILURE), as mandated by <xref
289 target="RFC3461"/>.</t>
290 <t>It is an error if the DSN submission option is present multiple times for one recipient.</t>
291 <t>Clients MUST NOT specify the DSN submission option unless the server announces the SUBMIT=DSN
292 capability. Support for the SUBMIT=DSN submission option is OPTIONAL.</t>
293 <t>The DSN specification is either "NONE" to deactivate DSNs altogether, or a parenthesized list of any
294 of the following DSN options:</t>
295 <t><list style="hanging">
296 <t hangText="SUCCESS"> requests generating DSNs upon successful delivery of a message</t>
297 <t hangText="DELAY"> activates generating DSNs when delivery is delayed</t>
298 <t hangText="FAILURE"> requests generating DSNs when the delivery fails</t>
300 <t>The order of DSN requests is not significant. A single DSN option item MUST NOT be repeated
301 in the DSN specification for one recipient.</t>
304 <section title="DSN-RET Submission Option">
305 <t>Syntax: DSN return option specification</t>
306 <t>This per-recipient submission option corresponds to the RET=... parameter from <xref
307 target="RFC3461"/>. Two values are defined, "HDRS" and "FULL", meaning to include only the
308 headers or the full message, respectively, in the generated delivery status reports.</t>
309 <t>Clients MUST NOT use the DSN-RET return option unless the server announces the SUBMIT=DSN
318 <section title="Example">
319 <t>This section contains an example of how message submission over IMAP works.</t>
321 <t>The following example shows how client should submit a message with UID 123 in the current mailbox for
322 delivery. If the message is passed through SMTP, its From address in the SMTP envelope MUST be set to
323 foo@example.org and it MUST be submitted for delivery to two recipients, the a@example.org and
324 b@example.org. The DSN options are set to report about excess delays and failures in message delivery for
325 the first recipient. System's default policy of DSN production is retained for the second recipient.</t>
327 <figure align="center">
328 <artwork align="left"><![CDATA[
329 C: x UID SUBMIT 123 (FROM "foo@example.org"
330 RECIPIENT "a@example.org" DSN (delay failure)
331 RECIPIENT "b@example.org"
333 S: * 10 FETCH (UID 123 FLAGS ($Submitted))
334 S: x OK Message passed to the sendmail binary]]></artwork>
337 <t>In the following example, a message is delivered to addresses specified in the message payload. No
338 delivery options are given, and therefore the From and To envelope items are inferred from the actual
339 payload. The DSN options, if supported, are set to an implementation-defined default value.</t>
341 <figure align="center">
342 <artwork align="left"><![CDATA[
344 S: * 10 FETCH (UID 123 FLAGS ($Submitted))
345 S: x OK Message passed to the sendmail binary]]></artwork>
350 <section anchor="Acknowledgements" title="Acknowledgements">
354 <section anchor="IANA" title="IANA Considerations">
355 <t>IMAP4 capabilities are registered by publishing a standards track or IESG approved experimental RFC. The
356 registry is currently located at:</t>
357 <t>http://www.iana.org/assignments/imap4-capabilities</t>
358 <t>This document defines the following list of IMAP capabilities. IANA will be asked to add them to the
360 <t><list style="symbols">
364 <t>FIXME: response codes</t>
367 <section anchor="ABNF" title="Formal Syntax">
368 <t>The following syntax specification uses the Augmented Backus-Naur
369 Form (ABNF) notation as specified in <xref target="RFC5234"/>.</t>
371 <t>Non-terminals referenced but not defined below are as defined by
372 <xref target="RFC3501"/>, or <xref target="RFC5234"/>.</t>
374 <figure align="center">
375 <artwork align="left" type="abnf"><![CDATA[
376 capability =/ "SUBMIT" / "SUBMIT=DSN"
377 ;; This extension also reserves all further
378 ;; capabilities starting with the "SUBMIT="
379 ;; prefix for future extensions related to the
380 ;; message submission over IMAP
382 uid =/ "UID" SP sendmail
384 sendmail = "SUBMIT" SP uniqueid [SP delivery-options]
386 delivery-options = "(" delivery-option *( SP delivery-option ) ")"
388 delivery-option = submission-from / submission-recipient
390 submission-from = "FROM" SP one-email-addr [SP mail-from-params]
391 ;; MUST NOT be present more than once
392 ;; in the delivery-options block
394 submission-recipient= "RECIPIENT" SP one-email-addr [SP mail-rcpt-params]
395 ;; MAY be present more than once
397 mail-from-params = "(" mail-from-param *( SP mail-from-param ) ")"
399 mail-from-param = sub-option-dsn-envid / sub-generic-option
401 mail-rcpt-params = "(" mail-rcpt-param *( SP mail-rcpt-param ) ")"
403 mail-rcpt-param = sub-option-rcpt-dsn / sub-option-dsn-ret
406 sub-generic-option = string SP string
407 ;; FIXME: do we want to retain this in without any semantics?
409 sub-option-rcpt-dsn = "DSN" SP ( "NONE" / dsn-spec )
410 ;; MUST NOT be present more than once for each recipient
412 dsn-spec = "(" dsn-spec-item *( SP dsn-spec-item ) ")"
413 ;; an individual dsn-spec-item MUST NOT
414 ;; be present more than once in this list
416 dsn-spec-item = "DELAY" / "FAILURE" / "SUCCESS"
418 sub-option-dsn-ret = "DSN-RET" SP ( "FULL" / "HDRS" )
419 ;; MUST NOT be present more than once for each recipient
421 sub-option-dsn-envid= "DSN-ENVID" SP xtext
422 ;; MUST NOT be present more than once
423 ;; <xtext> is defined in [RFC3461], section 4.
424 ;; The allowed syntax is further limited by
427 one-email-addr = string
428 ;; valid e-mail address as per [RFC5321]
433 <section anchor="Security" title="Security Considerations">
434 <t>This extension introduces a new way of allowing authenticated users to submit Internet mail. Servers
435 supporting this extension SHOULD implement the same security measures as other SUBMISSION <xref
436 target="RFC4409"/> servers open to users.</t>
438 <t>The redirect command from SIEVE <xref target="RFC5228"/> already requires some types of IMAP message stores
439 to be able to generate outgoing mail. Security considerations for this extension are similar.</t>
441 <t>For the IMAP-based submission to work, the server operators MUST configure their MTA systems to accept
442 submission requests from their IMAP servers. This change MAY have security implications, even though
443 services supporting the SIEVE filtering are already configured to accept e-mails for submission.</t>
445 <t>The new trust path MAY replace the trust path required for the BURL/URLAUTH operation required by the
446 LEMONADE extension family.</t>
451 <references title="Normative References">
481 <section anchor="FIXME" title="FIXME Items">
482 <t>IANA and the response codes</t>
483 <t>"if the command fails, server MUST clear both $SubmitPending and $Submitted" -- what to do when there's
484 something like a disk error?</t>
487 <section anchor="changelog" title="Changelog">
488 <section title="Changes in -02 since -01">
489 <t><list style="symbols">
490 <t>Clarified priorities of SUBMISSIONRACE and POLICYDENIED</t>
491 <t>Clarify failover procedure upon seeing a POLICYDENIED</t>
492 <t>Clarified message flag manipulation</t>
493 <t>Clarified recipient list mangling</t>
494 <t>More editorial work</t>
497 <section title="Changes in -01 since -00">
498 <t><list style="symbols">
499 <t>"Delivery options" is the new name for former "submission options"; changed the existing DSN options
500 family to use this new syntax (thanks to Arnt for this suggestion)</t>
501 <t>Clarified the visibility of the transitional state with both $Submitted and $SubmitPending</t>
502 <t>Some editorial work</t>
503 <t>Fixed an error in the example (multiple FROM addresses...)</t>
506 <section title="Changes in -00 since private-01">
507 <t><list style="symbols">
508 <t>Renamed to SUBMIT</t>
509 <t>DSNs are per-recipient, not per-message</t>
510 <t>The introduction was rewritten</t>
511 <t>Miscellaneous clarifications</t>
512 <t>Changed DSN NIL to DSN NONE</t>
513 <t>Clarified the semantics of the RECIPIENT submission option to guarantee Bcc privacy</t>
514 <t>Editorial tweaks, including changes to the required SHOULD/MUST/...</t>
515 <t>DSN's ENVID and RET</t>
519 <section title="Changes in private-01 since private-00">
520 <t><list style="symbols">
521 <t>Removed the superfluous SENDER submission option</t>
522 <t>Mandating Bcc removal in conformance with RFC 5321 / RFC 5322</t>