···20202. DONE Add a `Jmap.Api` module to make JMAP API requests over HTTP and parse the
2121 responses into the `Jmap.Types`. Used `Cohttp_lwt_unix` for the HTTP library.
2222 Note: There is a compilation issue with the current ezjsonm package on the system.
2323-3. Add an implementation of the Jmap_session handling.
2323+3. Add a `Jmap_mail` implementation that follows `spec/rfc8621.txt`
+6051
spec/rfc8621.txt
···11+22+33+44+55+66+77+Internet Engineering Task Force (IETF) N. Jenkins
88+Request for Comments: 8621 Fastmail
99+Updates: 5788 C. Newman
1010+Category: Standards Track Oracle
1111+ISSN: 2070-1721 August 2019
1212+1313+1414+ The JSON Meta Application Protocol (JMAP) for Mail
1515+1616+Abstract
1717+1818+ This document specifies a data model for synchronising email data
1919+ with a server using the JSON Meta Application Protocol (JMAP).
2020+ Clients can use this to efficiently search, access, organise, and
2121+ send messages, and to get push notifications for fast
2222+ resynchronisation when new messages are delivered or a change is made
2323+ in another client.
2424+2525+Status of This Memo
2626+2727+ This is an Internet Standards Track document.
2828+2929+ This document is a product of the Internet Engineering Task Force
3030+ (IETF). It represents the consensus of the IETF community. It has
3131+ received public review and has been approved for publication by the
3232+ Internet Engineering Steering Group (IESG). Further information on
3333+ Internet Standards is available in Section 2 of RFC 7841.
3434+3535+ Information about the current status of this document, any errata,
3636+ and how to provide feedback on it may be obtained at
3737+ https://www.rfc-editor.org/info/rfc8621.
3838+3939+Copyright Notice
4040+4141+ Copyright (c) 2019 IETF Trust and the persons identified as the
4242+ document authors. All rights reserved.
4343+4444+ This document is subject to BCP 78 and the IETF Trust's Legal
4545+ Provisions Relating to IETF Documents
4646+ (https://trustee.ietf.org/license-info) in effect on the date of
4747+ publication of this document. Please review these documents
4848+ carefully, as they describe your rights and restrictions with respect
4949+ to this document. Code Components extracted from this document must
5050+ include Simplified BSD License text as described in Section 4.e of
5151+ the Trust Legal Provisions and are provided without warranty as
5252+ described in the Simplified BSD License.
5353+5454+5555+5656+5757+5858+Jenkins & Newman Standards Track [Page 1]
5959+6060+RFC 8621 JMAP Mail August 2019
6161+6262+6363+Table of Contents
6464+6565+ 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
6666+ 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 4
6767+ 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 5
6868+ 1.3. Additions to the Capabilities Object . . . . . . . . . . 5
6969+ 1.3.1. urn:ietf:params:jmap:mail . . . . . . . . . . . . . . 5
7070+ 1.3.2. urn:ietf:params:jmap:submission . . . . . . . . . . . 7
7171+ 1.3.3. urn:ietf:params:jmap:vacationresponse . . . . . . . . 8
7272+ 1.4. Data Type Support in Different Accounts . . . . . . . . . 8
7373+ 1.5. Push . . . . . . . . . . . . . . . . . . . . . . . . . . 8
7474+ 1.5.1. Example . . . . . . . . . . . . . . . . . . . . . . . 9
7575+ 1.6. Ids . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7676+ 2. Mailboxes . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7777+ 2.1. Mailbox/get . . . . . . . . . . . . . . . . . . . . . . . 14
7878+ 2.2. Mailbox/changes . . . . . . . . . . . . . . . . . . . . . 14
7979+ 2.3. Mailbox/query . . . . . . . . . . . . . . . . . . . . . . 14
8080+ 2.4. Mailbox/queryChanges . . . . . . . . . . . . . . . . . . 15
8181+ 2.5. Mailbox/set . . . . . . . . . . . . . . . . . . . . . . . 16
8282+ 2.6. Example . . . . . . . . . . . . . . . . . . . . . . . . . 17
8383+ 3. Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8484+ 3.1. Thread/get . . . . . . . . . . . . . . . . . . . . . . . 22
8585+ 3.1.1. Example . . . . . . . . . . . . . . . . . . . . . . . 22
8686+ 3.2. Thread/changes . . . . . . . . . . . . . . . . . . . . . 22
8787+ 4. Emails . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8888+ 4.1. Properties of the Email Object . . . . . . . . . . . . . 23
8989+ 4.1.1. Metadata . . . . . . . . . . . . . . . . . . . . . . 24
9090+ 4.1.2. Header Fields Parsed Forms . . . . . . . . . . . . . 26
9191+ 4.1.3. Header Fields Properties . . . . . . . . . . . . . . 32
9292+ 4.1.4. Body Parts . . . . . . . . . . . . . . . . . . . . . 35
9393+ 4.2. Email/get . . . . . . . . . . . . . . . . . . . . . . . . 42
9494+ 4.2.1. Example . . . . . . . . . . . . . . . . . . . . . . . 44
9595+ 4.3. Email/changes . . . . . . . . . . . . . . . . . . . . . . 45
9696+ 4.4. Email/query . . . . . . . . . . . . . . . . . . . . . . . 45
9797+ 4.4.1. Filtering . . . . . . . . . . . . . . . . . . . . . . 46
9898+ 4.4.2. Sorting . . . . . . . . . . . . . . . . . . . . . . . 49
9999+ 4.4.3. Thread Collapsing . . . . . . . . . . . . . . . . . . 50
100100+ 4.5. Email/queryChanges . . . . . . . . . . . . . . . . . . . 51
101101+ 4.6. Email/set . . . . . . . . . . . . . . . . . . . . . . . . 51
102102+ 4.7. Email/copy . . . . . . . . . . . . . . . . . . . . . . . 53
103103+ 4.8. Email/import . . . . . . . . . . . . . . . . . . . . . . 54
104104+ 4.9. Email/parse . . . . . . . . . . . . . . . . . . . . . . . 56
105105+ 4.10. Examples . . . . . . . . . . . . . . . . . . . . . . . . 58
106106+ 5. Search Snippets . . . . . . . . . . . . . . . . . . . . . . . 68
107107+ 5.1. SearchSnippet/get . . . . . . . . . . . . . . . . . . . . 69
108108+ 5.2. Example . . . . . . . . . . . . . . . . . . . . . . . . . 71
109109+110110+111111+112112+113113+114114+Jenkins & Newman Standards Track [Page 2]
115115+116116+RFC 8621 JMAP Mail August 2019
117117+118118+119119+ 6. Identities . . . . . . . . . . . . . . . . . . . . . . . . . 72
120120+ 6.1. Identity/get . . . . . . . . . . . . . . . . . . . . . . 73
121121+ 6.2. Identity/changes . . . . . . . . . . . . . . . . . . . . 73
122122+ 6.3. Identity/set . . . . . . . . . . . . . . . . . . . . . . 73
123123+ 6.4. Example . . . . . . . . . . . . . . . . . . . . . . . . . 73
124124+ 7. Email Submission . . . . . . . . . . . . . . . . . . . . . . 74
125125+ 7.1. EmailSubmission/get . . . . . . . . . . . . . . . . . . . 80
126126+ 7.2. EmailSubmission/changes . . . . . . . . . . . . . . . . . 80
127127+ 7.3. EmailSubmission/query . . . . . . . . . . . . . . . . . . 80
128128+ 7.4. EmailSubmission/queryChanges . . . . . . . . . . . . . . 81
129129+ 7.5. EmailSubmission/set . . . . . . . . . . . . . . . . . . . 81
130130+ 7.5.1. Example . . . . . . . . . . . . . . . . . . . . . . . 84
131131+ 8. Vacation Response . . . . . . . . . . . . . . . . . . . . . . 86
132132+ 8.1. VacationResponse/get . . . . . . . . . . . . . . . . . . 87
133133+ 8.2. VacationResponse/set . . . . . . . . . . . . . . . . . . 88
134134+ 9. Security Considerations . . . . . . . . . . . . . . . . . . . 88
135135+ 9.1. EmailBodyPart Value . . . . . . . . . . . . . . . . . . . 88
136136+ 9.2. HTML Email Display . . . . . . . . . . . . . . . . . . . 88
137137+ 9.3. Multiple Part Display . . . . . . . . . . . . . . . . . . 91
138138+ 9.4. Email Submission . . . . . . . . . . . . . . . . . . . . 91
139139+ 9.5. Partial Account Access . . . . . . . . . . . . . . . . . 92
140140+ 9.6. Permission to Send from an Address . . . . . . . . . . . 92
141141+ 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 93
142142+ 10.1. JMAP Capability Registration for "mail" . . . . . . . . 93
143143+ 10.2. JMAP Capability Registration for "submission" . . . . . 93
144144+ 10.3. JMAP Capability Registration for "vacationresponse" . . 94
145145+ 10.4. IMAP and JMAP Keywords Registry . . . . . . . . . . . . 94
146146+ 10.4.1. Registration of JMAP Keyword "$draft" . . . . . . . 95
147147+ 10.4.2. Registration of JMAP Keyword "$seen" . . . . . . . . 96
148148+ 10.4.3. Registration of JMAP Keyword "$flagged" . . . . . . 97
149149+ 10.4.4. Registration of JMAP Keyword "$answered" . . . . . . 98
150150+ 10.4.5. Registration of "$recent" Keyword . . . . . . . . . 99
151151+ 10.5. IMAP Mailbox Name Attributes Registry . . . . . . . . . 99
152152+ 10.5.1. Registration of "inbox" Role . . . . . . . . . . . . 99
153153+ 10.6. JMAP Error Codes Registry . . . . . . . . . . . . . . . 100
154154+ 10.6.1. mailboxHasChild . . . . . . . . . . . . . . . . . . 100
155155+ 10.6.2. mailboxHasEmail . . . . . . . . . . . . . . . . . . 100
156156+ 10.6.3. blobNotFound . . . . . . . . . . . . . . . . . . . . 100
157157+ 10.6.4. tooManyKeywords . . . . . . . . . . . . . . . . . . 101
158158+ 10.6.5. tooManyMailboxes . . . . . . . . . . . . . . . . . . 101
159159+ 10.6.6. invalidEmail . . . . . . . . . . . . . . . . . . . . 101
160160+ 10.6.7. tooManyRecipients . . . . . . . . . . . . . . . . . 102
161161+ 10.6.8. noRecipients . . . . . . . . . . . . . . . . . . . . 102
162162+ 10.6.9. invalidRecipients . . . . . . . . . . . . . . . . . 102
163163+ 10.6.10. forbiddenMailFrom . . . . . . . . . . . . . . . . . 103
164164+ 10.6.11. forbiddenFrom . . . . . . . . . . . . . . . . . . . 103
165165+ 10.6.12. forbiddenToSend . . . . . . . . . . . . . . . . . . 103
166166+167167+168168+169169+170170+Jenkins & Newman Standards Track [Page 3]
171171+172172+RFC 8621 JMAP Mail August 2019
173173+174174+175175+ 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 104
176176+ 11.1. Normative References . . . . . . . . . . . . . . . . . . 104
177177+ 11.2. Informative References . . . . . . . . . . . . . . . . . 107
178178+ Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 108
179179+180180+1. Introduction
181181+182182+ The JSON Meta Application Protocol (JMAP) [RFC8620] is a generic
183183+ protocol for synchronising data, such as mail, calendars, or contacts
184184+ between a client and a server. It is optimised for mobile and web
185185+ environments and aims to provide a consistent interface to different
186186+ data types.
187187+188188+ This specification defines a data model for accessing a mail store
189189+ over JMAP, allowing you to query, read, organise, and submit mail for
190190+ sending.
191191+192192+ The data model is designed to allow a server to provide consistent
193193+ access to the same data via IMAP [RFC3501] as well as JMAP. As in
194194+ IMAP, a message must belong to a mailbox; however, in JMAP, its id
195195+ does not change if you move it between mailboxes, and the server may
196196+ allow it to belong to multiple mailboxes simultaneously (often
197197+ exposed in a user agent as labels rather than folders).
198198+199199+ As in IMAP, messages may also be assigned zero or more keywords:
200200+ short arbitrary strings. These are primarily intended to store
201201+ metadata to inform client display, such as unread status or whether a
202202+ message has been replied to. An IANA registry allows common
203203+ semantics to be shared between clients and extended easily in the
204204+ future.
205205+206206+ A message and its replies are linked on the server by a common Thread
207207+ id. Clients may fetch the list of messages with a particular Thread
208208+ id to more easily present a threaded or conversational interface.
209209+210210+ Permissions for message access happen on a per-mailbox basis.
211211+ Servers may give the user restricted permissions for certain
212212+ mailboxes, for example, if another user's inbox has been shared as
213213+ read-only with them.
214214+215215+1.1. Notational Conventions
216216+217217+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
218218+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
219219+ "OPTIONAL" in this document are to be interpreted as described in
220220+ BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
221221+ capitals, as shown here.
222222+223223+224224+225225+226226+Jenkins & Newman Standards Track [Page 4]
227227+228228+RFC 8621 JMAP Mail August 2019
229229+230230+231231+ Type signatures, examples, and property descriptions in this document
232232+ follow the conventions established in Section 1.1 of [RFC8620]. Data
233233+ types defined in the core specification are also used in this
234234+ document.
235235+236236+ Servers MUST support all properties specified for the new data types
237237+ defined in this document.
238238+239239+1.2. Terminology
240240+241241+ This document uses the same terminology as in the core JMAP
242242+ specification.
243243+244244+ The terms Mailbox, Thread, Email, SearchSnippet, EmailSubmission and
245245+ VacationResponse (with that specific capitalisation) are used to
246246+ refer to the data types defined in this document and instances of
247247+ those data types.
248248+249249+ The term message refers to a document in Internet Message Format, as
250250+ described in [RFC5322]. The Email data type represents messages in
251251+ the mail store and associated metadata.
252252+253253+1.3. Additions to the Capabilities Object
254254+255255+ The capabilities object is returned as part of the JMAP Session
256256+ object; see [RFC8620], Section 2.
257257+258258+ This document defines three additional capability URIs.
259259+260260+1.3.1. urn:ietf:params:jmap:mail
261261+262262+ This represents support for the Mailbox, Thread, Email, and
263263+ SearchSnippet data types and associated API methods. The value of
264264+ this property in the JMAP session "capabilities" property is an empty
265265+ object.
266266+267267+ The value of this property in an account's "accountCapabilities"
268268+ property is an object that MUST contain the following information on
269269+ server capabilities and permissions for that account:
270270+271271+ o maxMailboxesPerEmail: "UnsignedInt|null"
272272+273273+ The maximum number of Mailboxes (see Section 2) that can be can
274274+ assigned to a single Email object (see Section 4). This MUST be
275275+ an integer >= 1, or null for no limit (or rather, the limit is
276276+ always the number of Mailboxes in the account).
277277+278278+279279+280280+281281+282282+Jenkins & Newman Standards Track [Page 5]
283283+284284+RFC 8621 JMAP Mail August 2019
285285+286286+287287+ o maxMailboxDepth: "UnsignedInt|null"
288288+289289+ The maximum depth of the Mailbox hierarchy (i.e., one more than
290290+ the maximum number of ancestors a Mailbox may have), or null for
291291+ no limit.
292292+293293+ o maxSizeMailboxName: "UnsignedInt"
294294+295295+ The maximum length, in (UTF-8) octets, allowed for the name of a
296296+ Mailbox. This MUST be at least 100, although it is recommended
297297+ servers allow more.
298298+299299+ o maxSizeAttachmentsPerEmail: "UnsignedInt"
300300+301301+ The maximum total size of attachments, in octets, allowed for a
302302+ single Email object. A server MAY still reject the import or
303303+ creation of an Email with a lower attachment size total (for
304304+ example, if the body includes several megabytes of text, causing
305305+ the size of the encoded MIME structure to be over some server-
306306+ defined limit).
307307+308308+ Note that this limit is for the sum of unencoded attachment sizes.
309309+ Users are generally not knowledgeable about encoding overhead,
310310+ etc., nor should they need to be, so marketing and help materials
311311+ normally tell them the "max size attachments". This is the
312312+ unencoded size they see on their hard drive, so this capability
313313+ matches that and allows the client to consistently enforce what
314314+ the user understands as the limit.
315315+316316+ The server may separately have a limit for the total size of the
317317+ message [RFC5322], created by combining the attachments (often
318318+ base64 encoded) with the message headers and bodies. For example,
319319+ suppose the server advertises "maxSizeAttachmentsPerEmail:
320320+ 50000000" (50 MB). The enforced server limit may be for a message
321321+ size of 70000000 octets. Even with base64 encoding and a 2 MB
322322+ HTML body, 50 MB attachments would fit under this limit.
323323+324324+ o emailQuerySortOptions: "String[]"
325325+326326+ A list of all the values the server supports for the "property"
327327+ field of the Comparator object in an "Email/query" sort (see
328328+ Section 4.4.2). This MAY include properties the client does not
329329+ recognise (for example, custom properties specified in a vendor
330330+ extension). Clients MUST ignore any unknown properties in the
331331+ list.
332332+333333+334334+335335+336336+337337+338338+Jenkins & Newman Standards Track [Page 6]
339339+340340+RFC 8621 JMAP Mail August 2019
341341+342342+343343+ o mayCreateTopLevelMailbox: "Boolean"
344344+345345+ If true, the user may create a Mailbox (see Section 2) in this
346346+ account with a null parentId. (Permission for creating a child of
347347+ an existing Mailbox is given by the "myRights" property on that
348348+ Mailbox.)
349349+350350+1.3.2. urn:ietf:params:jmap:submission
351351+352352+ This represents support for the Identity and EmailSubmission data
353353+ types and associated API methods. The value of this property in the
354354+ JMAP session "capabilities" property is an empty object.
355355+356356+ The value of this property in an account's "accountCapabilities"
357357+ property is an object that MUST contain the following information on
358358+ server capabilities and permissions for that account:
359359+360360+ o maxDelayedSend: "UnsignedInt"
361361+362362+ The number in seconds of the maximum delay the server supports in
363363+ sending (see the EmailSubmission object description). This is 0
364364+ if the server does not support delayed send.
365365+366366+ o submissionExtensions: "String[String[]]"
367367+368368+ The set of SMTP submission extensions supported by the server,
369369+ which the client may use when creating an EmailSubmission object
370370+ (see Section 7). Each key in the object is the "ehlo-name", and
371371+ the value is a list of "ehlo-args".
372372+373373+ A JMAP implementation that talks to a submission server [RFC6409]
374374+ SHOULD have a configuration setting that allows an administrator
375375+ to modify the set of submission EHLO capabilities it may expose on
376376+ this property. This allows a JMAP server to easily add access to
377377+ a new submission extension without code changes. By default, the
378378+ JMAP server should hide EHLO capabilities that have to do with the
379379+ transport mechanism and thus are only relevant to the JMAP server
380380+ (for example, PIPELINING, CHUNKING, or STARTTLS).
381381+382382+ Examples of Submission extensions to include:
383383+384384+ * FUTURERELEASE [RFC4865]
385385+386386+ * SIZE [RFC1870]
387387+388388+ * DSN [RFC3461]
389389+390390+ * DELIVERYBY [RFC2852]
391391+392392+393393+394394+Jenkins & Newman Standards Track [Page 7]
395395+396396+RFC 8621 JMAP Mail August 2019
397397+398398+399399+ * MT-PRIORITY [RFC6710]
400400+401401+ A JMAP server MAY advertise an extension and implement the
402402+ semantics of that extension locally on the JMAP server even if a
403403+ submission server used by JMAP doesn't implement it.
404404+405405+ The full IANA registry of submission extensions can be found at
406406+ <https://www.iana.org/assignments/mail-parameters>.
407407+408408+1.3.3. urn:ietf:params:jmap:vacationresponse
409409+410410+ This represents support for the VacationResponse data type and
411411+ associated API methods. The value of this property is an empty
412412+ object in both the JMAP session "capabilities" property and an
413413+ account's "accountCapabilities" property.
414414+415415+1.4. Data Type Support in Different Accounts
416416+417417+ The server MUST include the appropriate capability strings as keys in
418418+ the "accountCapabilities" property of any account with which the user
419419+ may use the data types represented by that URI. Supported data types
420420+ may differ between accounts the user has access to. For example, in
421421+ the user's personal account, they may have access to all three sets
422422+ of data, but in a shared account, they may only have data for
423423+ "urn:ietf:params:jmap:mail". This means they can access
424424+ Mailbox/Thread/Email data in the shared account but are not allowed
425425+ to send as that account (and so do not have access to Identity/
426426+ EmailSubmission objects) or view/set its VacationResponse.
427427+428428+1.5. Push
429429+430430+ Servers MUST support the JMAP push mechanisms, as specified in
431431+ [RFC8620], Section 7, to receive notifications when the state changes
432432+ for any of the types defined in this specification.
433433+434434+ In addition, servers that implement the "urn:ietf:params:jmap:mail"
435435+ capability MUST support pushing state changes for a type called
436436+ "EmailDelivery". There are no methods to act on this type; it only
437437+ exists as part of the push mechanism. The state string for this MUST
438438+ change whenever a new Email is added to the store, but it SHOULD NOT
439439+ change upon any other change to the Email objects, for example, if
440440+ one is marked as read or deleted.
441441+442442+ Clients in battery-constrained environments may wish to delay
443443+ fetching changes initiated by the user but fetch new Emails
444444+ immediately so they can notify the user. To do this, they can
445445+ register for pushes for the EmailDelivery type rather than the Email
446446+ type (as defined in Section 4).
447447+448448+449449+450450+Jenkins & Newman Standards Track [Page 8]
451451+452452+RFC 8621 JMAP Mail August 2019
453453+454454+455455+1.5.1. Example
456456+457457+ The client has registered for push notifications (see [RFC8620]) just
458458+ for the EmailDelivery type. The user marks an Email as read on
459459+ another device, causing the state string for the Email type to
460460+ change; however, as nothing new was added to the store, the
461461+ EmailDelivery state does not change and nothing is pushed to the
462462+ client. A new message arrives in the user's inbox, again causing the
463463+ Email state to change. This time, the EmailDelivery state also
464464+ changes, and a StateChange object is pushed to the client with the
465465+ new state string. The client may then resync to fetch the new Email
466466+ immediately.
467467+468468+1.6. Ids
469469+470470+ If a JMAP Mail server also provides an IMAP interface to the data and
471471+ supports IMAP Extension for Object Identifiers [RFC8474], the ids
472472+ SHOULD be the same for Mailbox, Thread, and Email objects in JMAP.
473473+474474+2. Mailboxes
475475+476476+ A Mailbox represents a named set of Email objects. This is the
477477+ primary mechanism for organising messages within an account. It is
478478+ analogous to a folder or a label in other systems. A Mailbox may
479479+ perform a certain role in the system; see below for more details.
480480+481481+ For compatibility with IMAP, an Email MUST belong to one or more
482482+ Mailboxes. The Email id does not change if the Email changes
483483+ Mailboxes.
484484+485485+ A *Mailbox* object has the following properties:
486486+487487+ o id: "Id" (immutable; server-set)
488488+489489+ The id of the Mailbox.
490490+491491+ o name: "String"
492492+493493+ User-visible name for the Mailbox, e.g., "Inbox". This MUST be a
494494+ Net-Unicode string [RFC5198] of at least 1 character in length,
495495+ subject to the maximum size given in the capability object. There
496496+ MUST NOT be two sibling Mailboxes with both the same parent and
497497+ the same name. Servers MAY reject names that violate server
498498+ policy (e.g., names containing a slash (/) or control characters).
499499+500500+501501+502502+503503+504504+505505+506506+Jenkins & Newman Standards Track [Page 9]
507507+508508+RFC 8621 JMAP Mail August 2019
509509+510510+511511+ o parentId: "Id|null" (default: null)
512512+513513+ The Mailbox id for the parent of this Mailbox, or null if this
514514+ Mailbox is at the top level. Mailboxes form acyclic graphs
515515+ (forests) directed by the child-to-parent relationship. There
516516+ MUST NOT be a loop.
517517+518518+ o role: "String|null" (default: null)
519519+520520+ Identifies Mailboxes that have a particular common purpose (e.g.,
521521+ the "inbox"), regardless of the "name" property (which may be
522522+ localised).
523523+524524+ This value is shared with IMAP (exposed in IMAP via the SPECIAL-
525525+ USE extension [RFC6154]). However, unlike in IMAP, a Mailbox MUST
526526+ only have a single role, and there MUST NOT be two Mailboxes in
527527+ the same account with the same role. Servers providing IMAP
528528+ access to the same data are encouraged to enforce these extra
529529+ restrictions in IMAP as well. Otherwise, modifying the IMAP
530530+ attributes to ensure compliance when exposing the data over JMAP
531531+ is implementation dependent.
532532+533533+ The value MUST be one of the Mailbox attribute names listed in the
534534+ IANA "IMAP Mailbox Name Attributes" registry at
535535+ <https://www.iana.org/assignments/imap-mailbox-name-attributes/>,
536536+ as established in [RFC8457], converted to lowercase. New roles
537537+ may be established here in the future.
538538+539539+ An account is not required to have Mailboxes with any particular
540540+ roles.
541541+542542+ o sortOrder: "UnsignedInt" (default: 0)
543543+544544+ Defines the sort order of Mailboxes when presented in the client's
545545+ UI, so it is consistent between devices. The number MUST be an
546546+ integer in the range 0 <= sortOrder < 2^31.
547547+548548+ A Mailbox with a lower order should be displayed before a Mailbox
549549+ with a higher order (that has the same parent) in any Mailbox
550550+ listing in the client's UI. Mailboxes with equal order SHOULD be
551551+ sorted in alphabetical order by name. The sorting should take
552552+ into account locale-specific character order convention.
553553+554554+ o totalEmails: "UnsignedInt" (server-set)
555555+556556+ The number of Emails in this Mailbox.
557557+558558+559559+560560+561561+562562+Jenkins & Newman Standards Track [Page 10]
563563+564564+RFC 8621 JMAP Mail August 2019
565565+566566+567567+ o unreadEmails: "UnsignedInt" (server-set)
568568+569569+ The number of Emails in this Mailbox that have neither the "$seen"
570570+ keyword nor the "$draft" keyword.
571571+572572+ o totalThreads: "UnsignedInt" (server-set)
573573+574574+ The number of Threads where at least one Email in the Thread is in
575575+ this Mailbox.
576576+577577+ o unreadThreads: "UnsignedInt" (server-set)
578578+579579+ An indication of the number of "unread" Threads in the Mailbox.
580580+581581+ For compatibility with existing implementations, the way "unread
582582+ Threads" is determined is not mandated in this document. The
583583+ simplest solution to implement is simply the number of Threads
584584+ where at least one Email in the Thread is both in this Mailbox and
585585+ has neither the "$seen" nor "$draft" keywords.
586586+587587+ However, a quality implementation will return the number of unread
588588+ items the user would see if they opened that Mailbox. A Thread is
589589+ shown as unread if it contains any unread Emails that will be
590590+ displayed when the Thread is opened. Therefore, "unreadThreads"
591591+ should be the number of Threads where at least one Email in the
592592+ Thread has neither the "$seen" nor the "$draft" keyword AND at
593593+ least one Email in the Thread is in this Mailbox. Note that the
594594+ unread Email does not need to be the one in this Mailbox. In
595595+ addition, the trash Mailbox (that is, a Mailbox whose "role" is
596596+ "trash") requires special treatment:
597597+598598+ 1. Emails that are *only* in the trash (and no other Mailbox) are
599599+ ignored when calculating the "unreadThreads" count of other
600600+ Mailboxes.
601601+602602+ 2. Emails that are *not* in the trash are ignored when
603603+ calculating the "unreadThreads" count for the trash Mailbox.
604604+605605+ The result of this is that Emails in the trash are treated as
606606+ though they are in a separate Thread for the purposes of unread
607607+ counts. It is expected that clients will hide Emails in the trash
608608+ when viewing a Thread in another Mailbox, and vice versa. This
609609+ allows you to delete a single Email to the trash out of a Thread.
610610+611611+ For example, suppose you have an account where the entire contents
612612+ is a single Thread with 2 Emails: an unread Email in the trash and
613613+ a read Email in the inbox. The "unreadThreads" count would be 1
614614+ for the trash and 0 for the inbox.
615615+616616+617617+618618+Jenkins & Newman Standards Track [Page 11]
619619+620620+RFC 8621 JMAP Mail August 2019
621621+622622+623623+ o myRights: "MailboxRights" (server-set)
624624+625625+ The set of rights (Access Control Lists (ACLs)) the user has in
626626+ relation to this Mailbox. These are backwards compatible with
627627+ IMAP ACLs, as defined in [RFC4314]. A *MailboxRights* object has
628628+ the following properties:
629629+630630+ * mayReadItems: "Boolean"
631631+632632+ If true, the user may use this Mailbox as part of a filter in
633633+ an "Email/query" call, and the Mailbox may be included in the
634634+ "mailboxIds" property of Email objects. Email objects may be
635635+ fetched if they are in *at least one* Mailbox with this
636636+ permission. If a sub-Mailbox is shared but not the parent
637637+ Mailbox, this may be false. Corresponds to IMAP ACLs "lr" (if
638638+ mapping from IMAP, both are required for this to be true).
639639+640640+ * mayAddItems: "Boolean"
641641+642642+ The user may add mail to this Mailbox (by either creating a new
643643+ Email or moving an existing one). Corresponds to IMAP ACL "i".
644644+645645+ * mayRemoveItems: "Boolean"
646646+647647+ The user may remove mail from this Mailbox (by either changing
648648+ the Mailboxes of an Email or destroying the Email).
649649+ Corresponds to IMAP ACLs "te" (if mapping from IMAP, both are
650650+ required for this to be true).
651651+652652+ * maySetSeen: "Boolean"
653653+654654+ The user may add or remove the "$seen" keyword to/from an
655655+ Email. If an Email belongs to multiple Mailboxes, the user may
656656+ only modify "$seen" if they have this permission for *all* of
657657+ the Mailboxes. Corresponds to IMAP ACL "s".
658658+659659+ * maySetKeywords: "Boolean"
660660+661661+ The user may add or remove any keyword other than "$seen" to/
662662+ from an Email. If an Email belongs to multiple Mailboxes, the
663663+ user may only modify keywords if they have this permission for
664664+ *all* of the Mailboxes. Corresponds to IMAP ACL "w".
665665+666666+ * mayCreateChild: "Boolean"
667667+668668+ The user may create a Mailbox with this Mailbox as its parent.
669669+ Corresponds to IMAP ACL "k".
670670+671671+672672+673673+674674+Jenkins & Newman Standards Track [Page 12]
675675+676676+RFC 8621 JMAP Mail August 2019
677677+678678+679679+ * mayRename: "Boolean"
680680+681681+ The user may rename the Mailbox or make it a child of another
682682+ Mailbox. Corresponds to IMAP ACL "x" (although this covers
683683+ both rename and delete permissions).
684684+685685+ * mayDelete: "Boolean"
686686+687687+ The user may delete the Mailbox itself. Corresponds to IMAP
688688+ ACL "x" (although this covers both rename and delete
689689+ permissions).
690690+691691+ * maySubmit: "Boolean"
692692+693693+ Messages may be submitted directly to this Mailbox.
694694+ Corresponds to IMAP ACL "p".
695695+696696+ o isSubscribed: "Boolean"
697697+698698+ Has the user indicated they wish to see this Mailbox in their
699699+ client? This SHOULD default to false for Mailboxes in shared
700700+ accounts the user has access to and true for any new Mailboxes
701701+ created by the user themself. This MUST be stored separately per
702702+ user where multiple users have access to a shared Mailbox.
703703+704704+ A user may have permission to access a large number of shared
705705+ accounts, or a shared account with a very large set of Mailboxes,
706706+ but only be interested in the contents of a few of these. Clients
707707+ may choose to only display Mailboxes where the "isSubscribed"
708708+ property is set to true, and offer a separate UI to allow the user
709709+ to see and subscribe/unsubscribe from the full set of Mailboxes.
710710+ However, clients MAY choose to ignore this property, either
711711+ entirely for ease of implementation or just for an account where
712712+ "isPersonal" is true (indicating it is the user's own rather than
713713+ a shared account).
714714+715715+ This property corresponds to IMAP [RFC3501] mailbox subscriptions.
716716+717717+ For IMAP compatibility, an Email in both the trash and another
718718+ Mailbox SHOULD be treated by the client as existing in both places
719719+ (i.e., when emptying the trash, the client should just remove it from
720720+ the trash Mailbox and leave it in the other Mailbox).
721721+722722+ The following JMAP methods are supported.
723723+724724+725725+726726+727727+728728+729729+730730+Jenkins & Newman Standards Track [Page 13]
731731+732732+RFC 8621 JMAP Mail August 2019
733733+734734+735735+2.1. Mailbox/get
736736+737737+ This is a standard "/get" method as described in [RFC8620],
738738+ Section 5.1. The "ids" argument may be "null" to fetch all at once.
739739+740740+2.2. Mailbox/changes
741741+742742+ This is a standard "/changes" method as described in [RFC8620],
743743+ Section 5.2 but with one extra argument to the response:
744744+745745+ o updatedProperties: "String[]|null"
746746+747747+ If only the "totalEmails", "unreadEmails", "totalThreads", and/or
748748+ "unreadThreads" Mailbox properties have changed since the old
749749+ state, this will be the list of properties that may have changed.
750750+ If the server is unable to tell if only counts have changed, it
751751+ MUST just be null.
752752+753753+ Since counts frequently change but other properties are generally
754754+ only changed rarely, the server can help the client optimise data
755755+ transfer by keeping track of changes to Email/Thread counts separate
756756+ from other state changes. The "updatedProperties" array may be used
757757+ directly via a back-reference in a subsequent "Mailbox/get" call in
758758+ the same request, so only these properties are returned if nothing
759759+ else has changed.
760760+761761+2.3. Mailbox/query
762762+763763+ This is a standard "/query" method as described in [RFC8620],
764764+ Section 5.5 but with the following additional request argument:
765765+766766+ o sortAsTree: "Boolean" (default: false)
767767+768768+ If true, when sorting the query results and comparing Mailboxes A
769769+ and B:
770770+771771+ * If A is an ancestor of B, it always comes first regardless of
772772+ the sort comparators. Similarly, if A is descendant of B, then
773773+ B always comes first.
774774+775775+ * Otherwise, if A and B do not share a "parentId", find the
776776+ nearest ancestors of each that do have the same "parentId" and
777777+ compare the sort properties on those Mailboxes instead.
778778+779779+ The result of this is that the Mailboxes are sorted as a tree
780780+ according to the parentId properties, with each set of children
781781+ with a common parent sorted according to the standard sort
782782+ comparators.
783783+784784+785785+786786+Jenkins & Newman Standards Track [Page 14]
787787+788788+RFC 8621 JMAP Mail August 2019
789789+790790+791791+ o filterAsTree: "Boolean" (default: false)
792792+793793+ If true, a Mailbox is only included in the query if all its
794794+ ancestors are also included in the query according to the filter.
795795+796796+ A *FilterCondition* object has the following properties, any of which
797797+ may be omitted:
798798+799799+ o parentId: "Id|null"
800800+801801+ The Mailbox "parentId" property must match the given value
802802+ exactly.
803803+804804+ o name: "String"
805805+806806+ The Mailbox "name" property contains the given string.
807807+808808+ o role: "String|null"
809809+810810+ The Mailbox "role" property must match the given value exactly.
811811+812812+ o hasAnyRole: "Boolean"
813813+814814+ If true, a Mailbox matches if it has any non-null value for its
815815+ "role" property.
816816+817817+ o isSubscribed: "Boolean"
818818+819819+ The "isSubscribed" property of the Mailbox must be identical to
820820+ the value given to match the condition.
821821+822822+ A Mailbox object matches the FilterCondition if and only if all of
823823+ the given conditions match. If zero properties are specified, it is
824824+ automatically true for all objects.
825825+826826+ The following Mailbox properties MUST be supported for sorting:
827827+828828+ o "sortOrder"
829829+830830+ o "name"
831831+832832+2.4. Mailbox/queryChanges
833833+834834+ This is a standard "/queryChanges" method as described in [RFC8620],
835835+ Section 5.6.
836836+837837+838838+839839+840840+841841+842842+Jenkins & Newman Standards Track [Page 15]
843843+844844+RFC 8621 JMAP Mail August 2019
845845+846846+847847+2.5. Mailbox/set
848848+849849+ This is a standard "/set" method as described in [RFC8620],
850850+ Section 5.3 but with the following additional request argument:
851851+852852+ o onDestroyRemoveEmails: "Boolean" (default: false)
853853+854854+ If false, any attempt to destroy a Mailbox that still has Emails
855855+ in it will be rejected with a "mailboxHasEmail" SetError. If
856856+ true, any Emails that were in the Mailbox will be removed from it,
857857+ and if in no other Mailboxes, they will be destroyed when the
858858+ Mailbox is destroyed.
859859+860860+ The following extra SetError types are defined:
861861+862862+ For "destroy":
863863+864864+ o "mailboxHasChild": The Mailbox still has at least one child
865865+ Mailbox. The client MUST remove these before it can delete the
866866+ parent Mailbox.
867867+868868+ o "mailboxHasEmail": The Mailbox has at least one Email assigned to
869869+ it, and the "onDestroyRemoveEmails" argument was false.
870870+871871+872872+873873+874874+875875+876876+877877+878878+879879+880880+881881+882882+883883+884884+885885+886886+887887+888888+889889+890890+891891+892892+893893+894894+895895+896896+897897+898898+Jenkins & Newman Standards Track [Page 16]
899899+900900+RFC 8621 JMAP Mail August 2019
901901+902902+903903+2.6. Example
904904+905905+ Fetching all Mailboxes in an account:
906906+907907+ [[ "Mailbox/get", {
908908+ "accountId": "u33084183",
909909+ "ids": null
910910+ }, "0" ]]
911911+912912+ And the response:
913913+914914+ [[ "Mailbox/get", {
915915+ "accountId": "u33084183",
916916+ "state": "78540",
917917+ "list": [{
918918+ "id": "MB23cfa8094c0f41e6",
919919+ "name": "Inbox",
920920+ "parentId": null,
921921+ "role": "inbox",
922922+ "sortOrder": 10,
923923+ "totalEmails": 16307,
924924+ "unreadEmails": 13905,
925925+ "totalThreads": 5833,
926926+ "unreadThreads": 5128,
927927+ "myRights": {
928928+ "mayAddItems": true,
929929+ "mayRename": false,
930930+ "maySubmit": true,
931931+ "mayDelete": false,
932932+ "maySetKeywords": true,
933933+ "mayRemoveItems": true,
934934+ "mayCreateChild": true,
935935+ "maySetSeen": true,
936936+ "mayReadItems": true
937937+ },
938938+ "isSubscribed": true
939939+ }, {
940940+ "id": "MB674cc24095db49ce",
941941+ "name": "Important mail",
942942+ ...
943943+ }, ... ],
944944+ "notFound": []
945945+ }, "0" ]]
946946+947947+948948+949949+950950+951951+952952+953953+954954+Jenkins & Newman Standards Track [Page 17]
955955+956956+RFC 8621 JMAP Mail August 2019
957957+958958+959959+ Now suppose an Email is marked read, and we get a push update that
960960+ the Mailbox state has changed. You might fetch the updates like
961961+ this:
962962+963963+ [[ "Mailbox/changes", {
964964+ "accountId": "u33084183",
965965+ "sinceState": "78540"
966966+ }, "0" ],
967967+ [ "Mailbox/get", {
968968+ "accountId": "u33084183",
969969+ "#ids": {
970970+ "resultOf": "0",
971971+ "name": "Mailbox/changes",
972972+ "path": "/created"
973973+ }
974974+ }, "1" ],
975975+ [ "Mailbox/get", {
976976+ "accountId": "u33084183",
977977+ "#ids": {
978978+ "resultOf": "0",
979979+ "name": "Mailbox/changes",
980980+ "path": "/updated"
981981+ },
982982+ "#properties": {
983983+ "resultOf": "0",
984984+ "name": "Mailbox/changes",
985985+ "path": "/updatedProperties"
986986+ }
987987+ }, "2" ]]
988988+989989+990990+991991+992992+993993+994994+995995+996996+997997+998998+999999+10001000+10011001+10021002+10031003+10041004+10051005+10061006+10071007+10081008+10091009+10101010+Jenkins & Newman Standards Track [Page 18]
10111011+10121012+RFC 8621 JMAP Mail August 2019
10131013+10141014+10151015+ This fetches the list of ids for created/updated/destroyed Mailboxes,
10161016+ then using back-references, it fetches the data for just the created/
10171017+ updated Mailboxes in the same request. The response may look
10181018+ something like this:
10191019+10201020+ [[ "Mailbox/changes", {
10211021+ "accountId": "u33084183",
10221022+ "oldState": "78541",
10231023+ "newState": "78542",
10241024+ "hasMoreChanges": false,
10251025+ "updatedProperties": [
10261026+ "totalEmails", "unreadEmails",
10271027+ "totalThreads", "unreadThreads"
10281028+ ],
10291029+ "created": [],
10301030+ "updated": ["MB23cfa8094c0f41e6"],
10311031+ "destroyed": []
10321032+ }, "0" ],
10331033+ [ "Mailbox/get", {
10341034+ "accountId": "u33084183",
10351035+ "state": "78542",
10361036+ "list": [],
10371037+ "notFound": []
10381038+ }, "1" ],
10391039+ [ "Mailbox/get", {
10401040+ "accountId": "u33084183",
10411041+ "state": "78542",
10421042+ "list": [{
10431043+ "id": "MB23cfa8094c0f41e6",
10441044+ "totalEmails": 16307,
10451045+ "unreadEmails": 13903,
10461046+ "totalThreads": 5833,
10471047+ "unreadThreads": 5127
10481048+ }],
10491049+ "notFound": []
10501050+ }, "2" ]]
10511051+10521052+10531053+10541054+10551055+10561056+10571057+10581058+10591059+10601060+10611061+10621062+10631063+10641064+10651065+10661066+Jenkins & Newman Standards Track [Page 19]
10671067+10681068+RFC 8621 JMAP Mail August 2019
10691069+10701070+10711071+ Here's an example where we try to rename one Mailbox and destroy
10721072+ another:
10731073+10741074+ [[ "Mailbox/set", {
10751075+ "accountId": "u33084183",
10761076+ "ifInState": "78542",
10771077+ "update": {
10781078+ "MB674cc24095db49ce": {
10791079+ "name": "Maybe important mail"
10801080+ }
10811081+ },
10821082+ "destroy": [ "MB23cfa8094c0f41e6" ]
10831083+ }, "0" ]]
10841084+10851085+ Suppose the rename succeeds, but we don't have permission to destroy
10861086+ the Mailbox we tried to destroy; we might get back:
10871087+10881088+ [[ "Mailbox/set", {
10891089+ "accountId": "u33084183",
10901090+ "oldState": "78542",
10911091+ "newState": "78549",
10921092+ "updated": {
10931093+ "MB674cc24095db49ce": null
10941094+ },
10951095+ "notDestroyed": {
10961096+ "MB23cfa8094c0f41e6": {
10971097+ "type": "forbidden"
10981098+ }
10991099+ }
11001100+ }, "0" ]]
11011101+11021102+3. Threads
11031103+11041104+ Replies are grouped together with the original message to form a
11051105+ Thread. In JMAP, a Thread is simply a flat list of Emails, ordered
11061106+ by date. Every Email MUST belong to a Thread, even if it is the only
11071107+ Email in the Thread.
11081108+11091109+ The exact algorithm for determining whether two Emails belong to the
11101110+ same Thread is not mandated in this spec to allow for compatibility
11111111+ with different existing systems. For new implementations, it is
11121112+ suggested that two messages belong in the same Thread if both of the
11131113+ following conditions apply:
11141114+11151115+ 1. An identical message id [RFC5322] appears in both messages in any
11161116+ of the Message-Id, In-Reply-To, and References header fields.
11171117+11181118+11191119+11201120+11211121+11221122+Jenkins & Newman Standards Track [Page 20]
11231123+11241124+RFC 8621 JMAP Mail August 2019
11251125+11261126+11271127+ 2. After stripping automatically added prefixes such as "Fwd:",
11281128+ "Re:", "[List-Tag]", etc., and ignoring white space, the subjects
11291129+ are the same. This avoids the situation where a person replies
11301130+ to an old message as a convenient way of finding the right
11311131+ recipient to send to but changes the subject and starts a new
11321132+ conversation.
11331133+11341134+ If messages are delivered out of order for some reason, a user may
11351135+ have two Emails in the same Thread but without headers that associate
11361136+ them with each other. The arrival of a third Email may provide the
11371137+ missing references to join them all together into a single Thread.
11381138+ Since the "threadId" of an Email is immutable, if the server wishes
11391139+ to merge the Threads, it MUST handle this by deleting and reinserting
11401140+ (with a new Email id) the Emails that change "threadId".
11411141+11421142+ A *Thread* object has the following properties:
11431143+11441144+ o id: "Id" (immutable; server-set)
11451145+11461146+11471147+ The id of the Thread.
11481148+11491149+ o emailIds: "Id[]" (server-set)
11501150+11511151+ The ids of the Emails in the Thread, sorted by the "receivedAt"
11521152+ date of the Email, oldest first. If two Emails have an identical
11531153+ date, the sort is server dependent but MUST be stable (sorting by
11541154+ id is recommended).
11551155+11561156+ The following JMAP methods are supported.
11571157+11581158+11591159+11601160+11611161+11621162+11631163+11641164+11651165+11661166+11671167+11681168+11691169+11701170+11711171+11721172+11731173+11741174+11751175+11761176+11771177+11781178+Jenkins & Newman Standards Track [Page 21]
11791179+11801180+RFC 8621 JMAP Mail August 2019
11811181+11821182+11831183+3.1. Thread/get
11841184+11851185+ This is a standard "/get" method as described in [RFC8620],
11861186+ Section 5.1.
11871187+11881188+3.1.1. Example
11891189+11901190+ Request:
11911191+11921192+ [[ "Thread/get", {
11931193+ "accountId": "acme",
11941194+ "ids": ["f123u4", "f41u44"]
11951195+ }, "#1" ]]
11961196+11971197+ with response:
11981198+11991199+ [[ "Thread/get", {
12001200+ "accountId": "acme",
12011201+ "state": "f6a7e214",
12021202+ "list": [
12031203+ {
12041204+ "id": "f123u4",
12051205+ "emailIds": [ "eaa623", "f782cbb"]
12061206+ },
12071207+ {
12081208+ "id": "f41u44",
12091209+ "emailIds": [ "82cf7bb" ]
12101210+ }
12111211+ ],
12121212+ "notFound": []
12131213+ }, "#1" ]]
12141214+12151215+3.2. Thread/changes
12161216+12171217+ This is a standard "/changes" method as described in [RFC8620],
12181218+ Section 5.2.
12191219+12201220+4. Emails
12211221+12221222+ An *Email* object is a representation of a message [RFC5322], which
12231223+ allows clients to avoid the complexities of MIME parsing, transfer
12241224+ encoding, and character encoding.
12251225+12261226+12271227+12281228+12291229+12301230+12311231+12321232+12331233+12341234+Jenkins & Newman Standards Track [Page 22]
12351235+12361236+RFC 8621 JMAP Mail August 2019
12371237+12381238+12391239+4.1. Properties of the Email Object
12401240+12411241+ Broadly, a message consists of two parts: a list of header fields and
12421242+ then a body. The Email data type provides a way to access the full
12431243+ structure or to use simplified properties and avoid some complexity
12441244+ if this is sufficient for the client application.
12451245+12461246+ While raw headers can be fetched and set, the vast majority of
12471247+ clients should use an appropriate parsed form for each of the header
12481248+ fields it wants to process, as this allows it to avoid the
12491249+ complexities of various encodings that are required in a valid
12501250+ message per RFC 5322.
12511251+12521252+ The body of a message is normally a MIME-encoded set of documents in
12531253+ a tree structure. This may be arbitrarily nested, but the majority
12541254+ of email clients present a flat model of a message body (normally
12551255+ plaintext or HTML) with a set of attachments. Flattening the MIME
12561256+ structure to form this model can be difficult and causes
12571257+ inconsistency between clients. Therefore, in addition to the
12581258+ "bodyStructure" property, which gives the full tree, the Email object
12591259+ contains 3 alternate properties with flat lists of body parts:
12601260+12611261+ o "textBody"/"htmlBody": These provide a list of parts that should
12621262+ be rendered sequentially as the "body" of the message. This is a
12631263+ list rather than a single part as messages may have headers and/or
12641264+ footers appended/prepended as separate parts when they are
12651265+ transmitted, and some clients send text and images intended to be
12661266+ displayed inline in the body (or even videos and sound clips) as
12671267+ multiple parts rather than a single HTML part with referenced
12681268+ images.
12691269+12701270+ Because MIME allows for multiple representations of the same data
12711271+ (using "multipart/alternative"), there is a "textBody" property
12721272+ (which prefers a plaintext representation) and an "htmlBody"
12731273+ property (which prefers an HTML representation) to accommodate the
12741274+ two most common client requirements. The same part may appear in
12751275+ both lists where there is no alternative between the two.
12761276+12771277+ o "attachments": This provides a list of parts that should be
12781278+ presented as "attachments" to the message. Some images may be
12791279+ solely there for embedding within an HTML body part; clients may
12801280+ wish to not present these as attachments in the user interface if
12811281+ they are displaying the HTML with the embedded images directly.
12821282+ Some parts may also be in htmlBody/textBody; again, clients may
12831283+ wish to not present these as attachments in the user interface if
12841284+ rendered as part of the body.
12851285+12861286+12871287+12881288+12891289+12901290+Jenkins & Newman Standards Track [Page 23]
12911291+12921292+RFC 8621 JMAP Mail August 2019
12931293+12941294+12951295+ The "bodyValues" property allows for clients to fetch the value of
12961296+ text parts directly without having to do a second request for the
12971297+ blob and to have the server handle decoding the charset into unicode.
12981298+ This data is in a separate property rather than on the EmailBodyPart
12991299+ object to avoid duplication of large amounts of data, as the same
13001300+ part may be included twice if the client fetches more than one of
13011301+ bodyStructure, textBody, and htmlBody.
13021302+13031303+ In the following subsections, the common notational convention for
13041304+ wildcards has been adopted for content types, so "foo/*" means any
13051305+ content type that starts with "foo/".
13061306+13071307+ Due to the number of properties involved, the set of Email properties
13081308+ is specified over the following four subsections. This is purely for
13091309+ readability; all properties are top-level peers.
13101310+13111311+4.1.1. Metadata
13121312+13131313+ These properties represent metadata about the message in the mail
13141314+ store and are not derived from parsing the message itself.
13151315+13161316+ o id: "Id" (immutable; server-set)
13171317+13181318+ The id of the Email object. Note that this is the JMAP object id,
13191319+ NOT the Message-ID header field value of the message [RFC5322].
13201320+13211321+ o blobId: "Id" (immutable; server-set)
13221322+13231323+ The id representing the raw octets of the message [RFC5322] for
13241324+ this Email. This may be used to download the raw original message
13251325+ or to attach it directly to another Email, etc.
13261326+13271327+ o threadId: "Id" (immutable; server-set)
13281328+13291329+ The id of the Thread to which this Email belongs.
13301330+13311331+ o mailboxIds: "Id[Boolean]"
13321332+13331333+ The set of Mailbox ids this Email belongs to. An Email in the
13341334+ mail store MUST belong to one or more Mailboxes at all times
13351335+ (until it is destroyed). The set is represented as an object,
13361336+ with each key being a Mailbox id. The value for each key in the
13371337+ object MUST be true.
13381338+13391339+13401340+13411341+13421342+13431343+13441344+13451345+13461346+Jenkins & Newman Standards Track [Page 24]
13471347+13481348+RFC 8621 JMAP Mail August 2019
13491349+13501350+13511351+ o keywords: "String[Boolean]" (default: {})
13521352+13531353+ A set of keywords that apply to the Email. The set is represented
13541354+ as an object, with the keys being the keywords. The value for
13551355+ each key in the object MUST be true.
13561356+13571357+ Keywords are shared with IMAP. The six system keywords from IMAP
13581358+ get special treatment. The following four keywords have their
13591359+ first character changed from "\" in IMAP to "$" in JMAP and have
13601360+ particular semantic meaning:
13611361+13621362+ * "$draft": The Email is a draft the user is composing.
13631363+13641364+ * "$seen": The Email has been read.
13651365+13661366+ * "$flagged": The Email has been flagged for urgent/special
13671367+ attention.
13681368+13691369+ * "$answered": The Email has been replied to.
13701370+13711371+ The IMAP "\Recent" keyword is not exposed via JMAP. The IMAP
13721372+ "\Deleted" keyword is also not present: IMAP uses a delete+expunge
13731373+ model, which JMAP does not. Any message with the "\Deleted"
13741374+ keyword MUST NOT be visible via JMAP (and so are not counted in
13751375+ the "totalEmails", "unreadEmails", "totalThreads", and
13761376+ "unreadThreads" Mailbox properties).
13771377+13781378+ Users may add arbitrary keywords to an Email. For compatibility
13791379+ with IMAP, a keyword is a case-insensitive string of 1-255
13801380+ characters in the ASCII subset %x21-%x7e (excludes control chars
13811381+ and space), and it MUST NOT include any of these characters:
13821382+13831383+ ( ) { ] % * " \
13841384+13851385+ Because JSON is case sensitive, servers MUST return keywords in
13861386+ lowercase.
13871387+13881388+ The IANA "IMAP and JMAP Keywords" registry at
13891389+ <https://www.iana.org/assignments/imap-jmap-keywords/> as
13901390+ established in [RFC5788] assigns semantic meaning to some other
13911391+ keywords in common use. New keywords may be established here in
13921392+ the future. In particular, note:
13931393+13941394+ * "$forwarded": The Email has been forwarded.
13951395+13961396+ * "$phishing": The Email is highly likely to be phishing.
13971397+ Clients SHOULD warn users to take care when viewing this Email
13981398+ and disable links and attachments.
13991399+14001400+14011401+14021402+Jenkins & Newman Standards Track [Page 25]
14031403+14041404+RFC 8621 JMAP Mail August 2019
14051405+14061406+14071407+ * "$junk": The Email is definitely spam. Clients SHOULD set this
14081408+ flag when users report spam to help train automated spam-
14091409+ detection systems.
14101410+14111411+ * "$notjunk": The Email is definitely not spam. Clients SHOULD
14121412+ set this flag when users indicate an Email is legitimate, to
14131413+ help train automated spam-detection systems.
14141414+14151415+ o size: "UnsignedInt" (immutable; server-set)
14161416+14171417+ The size, in octets, of the raw data for the message [RFC5322] (as
14181418+ referenced by the "blobId", i.e., the number of octets in the file
14191419+ the user would download).
14201420+14211421+ o receivedAt: "UTCDate" (immutable; default: time of creation on
14221422+ server)
14231423+14241424+ The date the Email was received by the message store. This is the
14251425+ "internal date" in IMAP [RFC3501].
14261426+14271427+4.1.2. Header Fields Parsed Forms
14281428+14291429+ Header field properties are derived from the message header fields
14301430+ [RFC5322] [RFC6532]. All header fields may be fetched in a raw form.
14311431+ Some header fields may also be fetched in a parsed form. The
14321432+ structured form that may be fetched depends on the header. The forms
14331433+ are defined in the subsections that follow.
14341434+14351435+4.1.2.1. Raw
14361436+14371437+ Type: "String"
14381438+14391439+ The raw octets of the header field value from the first octet
14401440+ following the header field name terminating colon, up to but
14411441+ excluding the header field terminating CRLF. Any standards-compliant
14421442+ message MUST be either ASCII (RFC 5322) or UTF-8 (RFC 6532); however,
14431443+ other encodings exist in the wild. A server SHOULD replace any octet
14441444+ or octet run with the high bit set that violates UTF-8 syntax with
14451445+ the unicode replacement character (U+FFFD). Any NUL octet MUST be
14461446+ dropped.
14471447+14481448+ This form will typically have a leading space, as most generated
14491449+ messages insert a space after the colon that terminates the header
14501450+ field name.
14511451+14521452+14531453+14541454+14551455+14561456+14571457+14581458+Jenkins & Newman Standards Track [Page 26]
14591459+14601460+RFC 8621 JMAP Mail August 2019
14611461+14621462+14631463+4.1.2.2. Text
14641464+14651465+ Type: "String"
14661466+14671467+ The header field value with:
14681468+14691469+ 1. White space unfolded (as defined in [RFC5322], Section 2.2.3).
14701470+14711471+ 2. The terminating CRLF at the end of the value removed.
14721472+14731473+ 3. Any SP characters at the beginning of the value removed.
14741474+14751475+ 4. Any syntactically correct encoded sections [RFC2047] with a known
14761476+ character set decoded. Any NUL octets or control characters
14771477+ encoded per [RFC2047] are dropped from the decoded value. Any
14781478+ text that looks like syntax per [RFC2047] but violates placement
14791479+ or white space rules per [RFC2047] MUST NOT be decoded.
14801480+14811481+ 5. The resulting unicode converted to Normalization Form C (NFC)
14821482+ form.
14831483+14841484+ If any decodings fail, the parser SHOULD insert a unicode replacement
14851485+ character (U+FFFD) and attempt to continue as much as possible.
14861486+14871487+ To prevent obviously nonsense behaviour, which can lead to
14881488+ interoperability issues, this form may only be fetched or set for the
14891489+ following header fields:
14901490+14911491+ o Subject
14921492+14931493+ o Comments
14941494+14951495+ o Keywords
14961496+14971497+ o List-Id
14981498+14991499+ o Any header field not defined in [RFC5322] or [RFC2369]
15001500+15011501+4.1.2.3. Addresses
15021502+15031503+ Type: "EmailAddress[]"
15041504+15051505+ The header field is parsed as an "address-list" value, as specified
15061506+ in [RFC5322], Section 3.4, into the "EmailAddress[]" type. There is
15071507+ an EmailAddress item for each "mailbox" parsed from the "address-
15081508+ list". Group and comment information is discarded.
15091509+15101510+15111511+15121512+15131513+15141514+Jenkins & Newman Standards Track [Page 27]
15151515+15161516+RFC 8621 JMAP Mail August 2019
15171517+15181518+15191519+ An *EmailAddress* object has the following properties:
15201520+15211521+ o name: "String|null"
15221522+15231523+ The "display-name" of the "mailbox" [RFC5322]. If this is a
15241524+ "quoted-string":
15251525+15261526+ 1. The surrounding DQUOTE characters are removed.
15271527+15281528+ 2. Any "quoted-pair" is decoded.
15291529+15301530+ 3. White space is unfolded, and then any leading and trailing
15311531+ white space is removed.
15321532+15331533+ If there is no "display-name" but there is a "comment" immediately
15341534+ following the "addr-spec", the value of this SHOULD be used
15351535+ instead. Otherwise, this property is null.
15361536+15371537+ o email: "String"
15381538+15391539+ The "addr-spec" of the "mailbox" [RFC5322].
15401540+15411541+ Any syntactically correct encoded sections [RFC2047] with a known
15421542+ encoding MUST be decoded, following the same rules as for the Text
15431543+ form (see Section 4.1.2.2).
15441544+15451545+ Parsing SHOULD be best effort in the face of invalid structure to
15461546+ accommodate invalid messages and semi-complete drafts. EmailAddress
15471547+ objects MAY have an "email" property that does not conform to the
15481548+ "addr-spec" form (for example, may not contain an @ symbol).
15491549+15501550+ For example, the following "address-list" string:
15511551+15521552+ " James Smythe" <james@example.com>, Friends:
15531553+ jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?=
15541554+ <john@example.com>;
15551555+15561556+ would be parsed as:
15571557+15581558+ [
15591559+ { "name": "James Smythe", "email": "james@example.com" },
15601560+ { "name": null, "email": "jane@example.com" },
15611561+ { "name": "John Smith", "email": "john@example.com" }
15621562+ ]
15631563+15641564+15651565+15661566+15671567+15681568+15691569+15701570+Jenkins & Newman Standards Track [Page 28]
15711571+15721572+RFC 8621 JMAP Mail August 2019
15731573+15741574+15751575+ To prevent obviously nonsense behaviour, which can lead to
15761576+ interoperability issues, this form may only be fetched or set for the
15771577+ following header fields:
15781578+15791579+ o From
15801580+15811581+ o Sender
15821582+15831583+ o Reply-To
15841584+15851585+ o To
15861586+15871587+ o Cc
15881588+15891589+ o Bcc
15901590+15911591+ o Resent-From
15921592+15931593+ o Resent-Sender
15941594+15951595+ o Resent-Reply-To
15961596+15971597+ o Resent-To
15981598+15991599+ o Resent-Cc
16001600+16011601+ o Resent-Bcc
16021602+16031603+ o Any header field not defined in [RFC5322] or [RFC2369]
16041604+16051605+4.1.2.4. GroupedAddresses
16061606+16071607+ Type: "EmailAddressGroup[]"
16081608+16091609+ This is similar to the Addresses form but preserves group
16101610+ information. The header field is parsed as an "address-list" value,
16111611+ as specified in [RFC5322], Section 3.4, into the "GroupedAddresses[]"
16121612+ type. Consecutive "mailbox" values that are not part of a group are
16131613+ still collected under an EmailAddressGroup object to provide a
16141614+ uniform type.
16151615+16161616+16171617+16181618+16191619+16201620+16211621+16221622+16231623+16241624+16251625+16261626+Jenkins & Newman Standards Track [Page 29]
16271627+16281628+RFC 8621 JMAP Mail August 2019
16291629+16301630+16311631+ An *EmailAddressGroup* object has the following properties:
16321632+16331633+ o name: "String|null"
16341634+16351635+ The "display-name" of the "group" [RFC5322], or null if the
16361636+ addresses are not part of a group. If this is a "quoted-string",
16371637+ it is processed the same as the "name" in the EmailAddress type.
16381638+16391639+ o addresses: "EmailAddress[]"
16401640+16411641+ The "mailbox" values that belong to this group, represented as
16421642+ EmailAddress objects.
16431643+16441644+ Any syntactically correct encoded sections [RFC2047] with a known
16451645+ encoding MUST be decoded, following the same rules as for the Text
16461646+ form (see Section 4.1.2.2).
16471647+16481648+ Parsing SHOULD be best effort in the face of invalid structure to
16491649+ accommodate invalid messages and semi-complete drafts.
16501650+16511651+ For example, the following "address-list" string:
16521652+16531653+ " James Smythe" <james@example.com>, Friends:
16541654+ jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?=
16551655+ <john@example.com>;
16561656+16571657+ would be parsed as:
16581658+16591659+ [
16601660+ { "name": null, "addresses": [
16611661+ { "name": "James Smythe", "email": "james@example.com" }
16621662+ ]},
16631663+ { "name": "Friends", "addresses": [
16641664+ { "name": null, "email": "jane@example.com" },
16651665+ { "name": "John Smith", "email": "john@example.com" }
16661666+ ]}
16671667+ ]
16681668+16691669+ To prevent obviously nonsense behaviour, which can lead to
16701670+ interoperability issues, this form may only be fetched or set for the
16711671+ same header fields as the Addresses form (see Section 4.1.2.3).
16721672+16731673+16741674+16751675+16761676+16771677+16781678+16791679+16801680+16811681+16821682+Jenkins & Newman Standards Track [Page 30]
16831683+16841684+RFC 8621 JMAP Mail August 2019
16851685+16861686+16871687+4.1.2.5. MessageIds
16881688+16891689+ Type: "String[]|null"
16901690+16911691+ The header field is parsed as a list of "msg-id" values, as specified
16921692+ in [RFC5322], Section 3.6.4, into the "String[]" type. Comments and/
16931693+ or folding white space (CFWS) and surrounding angle brackets ("<>")
16941694+ are removed. If parsing fails, the value is null.
16951695+16961696+ To prevent obviously nonsense behaviour, which can lead to
16971697+ interoperability issues, this form may only be fetched or set for the
16981698+ following header fields:
16991699+17001700+ o Message-ID
17011701+17021702+ o In-Reply-To
17031703+17041704+ o References
17051705+17061706+ o Resent-Message-ID
17071707+17081708+ o Any header field not defined in [RFC5322] or [RFC2369]
17091709+17101710+4.1.2.6. Date
17111711+17121712+ Type: "Date|null"
17131713+17141714+ The header field is parsed as a "date-time" value, as specified in
17151715+ [RFC5322], Section 3.3, into the "Date" type. If parsing fails, the
17161716+ value is null.
17171717+17181718+ To prevent obviously nonsense behaviour, which can lead to
17191719+ interoperability issues, this form may only be fetched or set for the
17201720+ following header fields:
17211721+17221722+ o Date
17231723+17241724+ o Resent-Date
17251725+17261726+ o Any header field not defined in [RFC5322] or [RFC2369]
17271727+17281728+17291729+17301730+17311731+17321732+17331733+17341734+17351735+17361736+17371737+17381738+Jenkins & Newman Standards Track [Page 31]
17391739+17401740+RFC 8621 JMAP Mail August 2019
17411741+17421742+17431743+4.1.2.7. URLs
17441744+17451745+ Type: "String[]|null"
17461746+17471747+ The header field is parsed as a list of URLs, as described in
17481748+ [RFC2369], into the "String[]" type. Values do not include the
17491749+ surrounding angle brackets or any comments in the header field with
17501750+ the URLs. If parsing fails, the value is null.
17511751+17521752+ To prevent obviously nonsense behaviour, which can lead to
17531753+ interoperability issues, this form may only be fetched or set for the
17541754+ following header fields:
17551755+17561756+ o List-Help
17571757+17581758+ o List-Unsubscribe
17591759+17601760+ o List-Subscribe
17611761+17621762+ o List-Post
17631763+17641764+ o List-Owner
17651765+17661766+ o List-Archive
17671767+17681768+ o Any header field not defined in [RFC5322] or [RFC2369]
17691769+17701770+4.1.3. Header Fields Properties
17711771+17721772+ The following low-level Email property is specified for complete
17731773+ access to the header data of the message:
17741774+17751775+ o headers: "EmailHeader[]" (immutable)
17761776+17771777+ This is a list of all header fields [RFC5322], in the same order
17781778+ they appear in the message. An *EmailHeader* object has the
17791779+ following properties:
17801780+17811781+ * name: "String"
17821782+17831783+ The header "field name" as defined in [RFC5322], with the same
17841784+ capitalization that it has in the message.
17851785+17861786+ * value: "String"
17871787+17881788+ The header "field value" as defined in [RFC5322], in Raw form.
17891789+17901790+17911791+17921792+17931793+17941794+Jenkins & Newman Standards Track [Page 32]
17951795+17961796+RFC 8621 JMAP Mail August 2019
17971797+17981798+17991799+ In addition, the client may request/send properties representing
18001800+ individual header fields of the form:
18011801+18021802+ header:{header-field-name}
18031803+18041804+ Where "{header-field-name}" means any series of one or more printable
18051805+ ASCII characters (i.e., characters that have values between 33 and
18061806+ 126, inclusive), except for colon (:). The property may also have
18071807+ the following suffixes:
18081808+18091809+ o :as{header-form}
18101810+18111811+ This means the value is in a parsed form, where "{header-form}" is
18121812+ one of the parsed-form names specified above. If not given, the
18131813+ value is in Raw form.
18141814+18151815+ o :all
18161816+18171817+ This means the value is an array, with the items corresponding to
18181818+ each instance of the header field, in the order they appear in the
18191819+ message. If this suffix is not used, the result is the value of
18201820+ the *last* instance of the header field (i.e., identical to the
18211821+ last item in the array if :all is used), or null if none.
18221822+18231823+ If both suffixes are used, they MUST be specified in the order above.
18241824+ Header field names are matched case insensitively. The value is
18251825+ typed according to the requested form or to an array of that type if
18261826+ :all is used. If no header fields exist in the message with the
18271827+ requested name, the value is null if fetching a single instance or an
18281828+ empty array if requesting :all.
18291829+18301830+ As a simple example, if the client requests a property called
18311831+ "header:subject", this means find the *last* header field in the
18321832+ message named "subject" (matched case insensitively) and return the
18331833+ value in Raw form, or null if no header field of this name is found.
18341834+18351835+ For a more complex example, consider the client requesting a property
18361836+ called "header:Resent-To:asAddresses:all". This means:
18371837+18381838+ 1. Find *all* header fields named Resent-To (matched case
18391839+ insensitively).
18401840+18411841+ 2. For each instance, parse the header field value in the Addresses
18421842+ form.
18431843+18441844+ 3. The result is of type "EmailAddress[][]" -- each item in the
18451845+ array corresponds to the parsed value (which is itself an array)
18461846+ of the Resent-To header field instance.
18471847+18481848+18491849+18501850+Jenkins & Newman Standards Track [Page 33]
18511851+18521852+RFC 8621 JMAP Mail August 2019
18531853+18541854+18551855+ The following convenience properties are also specified for the Email
18561856+ object:
18571857+18581858+ o messageId: "String[]|null" (immutable)
18591859+18601860+ The value is identical to the value of "header:Message-
18611861+ ID:asMessageIds". For messages conforming to RFC 5322, this will
18621862+ be an array with a single entry.
18631863+18641864+ o inReplyTo: "String[]|null" (immutable)
18651865+18661866+ The value is identical to the value of "header:In-Reply-
18671867+ To:asMessageIds".
18681868+18691869+ o references: "String[]|null" (immutable)
18701870+18711871+ The value is identical to the value of
18721872+ "header:References:asMessageIds".
18731873+18741874+ o sender: "EmailAddress[]|null" (immutable)
18751875+18761876+ The value is identical to the value of
18771877+ "header:Sender:asAddresses".
18781878+18791879+ o from: "EmailAddress[]|null" (immutable)
18801880+18811881+ The value is identical to the value of "header:From:asAddresses".
18821882+18831883+ o to: "EmailAddress[]|null" (immutable)
18841884+18851885+ The value is identical to the value of "header:To:asAddresses".
18861886+18871887+ o cc: "EmailAddress[]|null" (immutable)
18881888+18891889+ The value is identical to the value of "header:Cc:asAddresses".
18901890+18911891+ o bcc: "EmailAddress[]|null" (immutable)
18921892+18931893+ The value is identical to the value of "header:Bcc:asAddresses".
18941894+18951895+ o replyTo: "EmailAddress[]|null" (immutable)
18961896+18971897+ The value is identical to the value of "header:Reply-
18981898+ To:asAddresses".
18991899+19001900+ o subject: "String|null" (immutable)
19011901+19021902+ The value is identical to the value of "header:Subject:asText".
19031903+19041904+19051905+19061906+Jenkins & Newman Standards Track [Page 34]
19071907+19081908+RFC 8621 JMAP Mail August 2019
19091909+19101910+19111911+ o sentAt: "Date|null" (immutable; default on creation: current
19121912+ server time)
19131913+19141914+ The value is identical to the value of "header:Date:asDate".
19151915+19161916+4.1.4. Body Parts
19171917+19181918+ These properties are derived from the message body [RFC5322] and its
19191919+ MIME entities [RFC2045].
19201920+19211921+ An *EmailBodyPart* object has the following properties:
19221922+19231923+ o partId: "String|null"
19241924+19251925+ Identifies this part uniquely within the Email. This is scoped to
19261926+ the "emailId" and has no meaning outside of the JMAP Email object
19271927+ representation. This is null if, and only if, the part is of type
19281928+ "multipart/*".
19291929+19301930+ o blobId: "Id|null"
19311931+19321932+ The id representing the raw octets of the contents of the part,
19331933+ after decoding any known Content-Transfer-Encoding (as defined in
19341934+ [RFC2045]), or null if, and only if, the part is of type
19351935+ "multipart/*". Note that two parts may be transfer-encoded
19361936+ differently but have the same blob id if their decoded octets are
19371937+ identical and the server is using a secure hash of the data for
19381938+ the blob id. If the transfer encoding is unknown, it is treated
19391939+ as though it had no transfer encoding.
19401940+19411941+ o size: "UnsignedInt"
19421942+19431943+ The size, in octets, of the raw data after content transfer
19441944+ decoding (as referenced by the "blobId", i.e., the number of
19451945+ octets in the file the user would download).
19461946+19471947+ o headers: "EmailHeader[]"
19481948+19491949+ This is a list of all header fields in the part, in the order they
19501950+ appear in the message. The values are in Raw form.
19511951+19521952+ o name: "String|null"
19531953+19541954+ This is the decoded "filename" parameter of the Content-
19551955+ Disposition header field per [RFC2231], or (for compatibility with
19561956+ existing systems) if not present, then it's the decoded "name"
19571957+ parameter of the Content-Type header field per [RFC2047].
19581958+19591959+19601960+19611961+19621962+Jenkins & Newman Standards Track [Page 35]
19631963+19641964+RFC 8621 JMAP Mail August 2019
19651965+19661966+19671967+ o type: "String"
19681968+19691969+ The value of the Content-Type header field of the part, if
19701970+ present; otherwise, the implicit type as per the MIME standard
19711971+ ("text/plain" or "message/rfc822" if inside a "multipart/digest").
19721972+ CFWS is removed and any parameters are stripped.
19731973+19741974+ o charset: "String|null"
19751975+19761976+ The value of the charset parameter of the Content-Type header
19771977+ field, if present, or null if the header field is present but not
19781978+ of type "text/*". If there is no Content-Type header field, or it
19791979+ exists and is of type "text/*" but has no charset parameter, this
19801980+ is the implicit charset as per the MIME standard: "us-ascii".
19811981+19821982+ o disposition: "String|null"
19831983+19841984+ The value of the Content-Disposition header field of the part, if
19851985+ present; otherwise, it's null. CFWS is removed and any parameters
19861986+ are stripped.
19871987+19881988+ o cid: "String|null"
19891989+19901990+ The value of the Content-Id header field of the part, if present;
19911991+ otherwise, it's null. CFWS and surrounding angle brackets ("<>")
19921992+ are removed. This may be used to reference the content from
19931993+ within a "text/html" body part [HTML] using the "cid:" protocol,
19941994+ as defined in [RFC2392].
19951995+19961996+ o language: "String[]|null"
19971997+19981998+ The list of language tags, as defined in [RFC3282], in the
19991999+ Content-Language header field of the part, if present.
20002000+20012001+ o location: "String|null"
20022002+20032003+ The URI, as defined in [RFC2557], in the Content-Location header
20042004+ field of the part, if present.
20052005+20062006+ o subParts: "EmailBodyPart[]|null"
20072007+20082008+ If the type is "multipart/*", this contains the body parts of each
20092009+ child.
20102010+20112011+ In addition, the client may request/send EmailBodyPart properties
20122012+ representing individual header fields, following the same syntax and
20132013+ semantics as for the Email object, e.g., "header:Content-Type".
20142014+20152015+20162016+20172017+20182018+Jenkins & Newman Standards Track [Page 36]
20192019+20202020+RFC 8621 JMAP Mail August 2019
20212021+20222022+20232023+ The following Email properties are specified for access to the body
20242024+ data of the message:
20252025+20262026+ o bodyStructure: "EmailBodyPart" (immutable)
20272027+20282028+ This is the full MIME structure of the message body, without
20292029+ recursing into "message/rfc822" or "message/global" parts. Note
20302030+ that EmailBodyParts may have subParts if they are of type
20312031+ "multipart/*".
20322032+20332033+ o bodyValues: "String[EmailBodyValue]" (immutable)
20342034+20352035+ This is a map of "partId" to an EmailBodyValue object for none,
20362036+ some, or all "text/*" parts. Which parts are included and whether
20372037+ the value is truncated is determined by various arguments to
20382038+ "Email/get" and "Email/parse". An *EmailBodyValue* object has the
20392039+ following properties:
20402040+20412041+ * value: "String"
20422042+20432043+ The value of the body part after decoding Content-Transfer-
20442044+ Encoding and the Content-Type charset, if both known to the
20452045+ server, and with any CRLF replaced with a single LF. The
20462046+ server MAY use heuristics to determine the charset to use for
20472047+ decoding if the charset is unknown, no charset is given, or it
20482048+ believes the charset given is incorrect. Decoding is best
20492049+ effort; the server SHOULD insert the unicode replacement
20502050+ character (U+FFFD) and continue when a malformed section is
20512051+ encountered.
20522052+20532053+ Note that due to the charset decoding and line ending
20542054+ normalisation, the length of this string will probably not be
20552055+ exactly the same as the "size" property on the corresponding
20562056+ EmailBodyPart.
20572057+20582058+ * isEncodingProblem: "Boolean" (default: false)
20592059+20602060+ This is true if malformed sections were found while decoding
20612061+ the charset, the charset was unknown, or the content-transfer-
20622062+ encoding was unknown.
20632063+20642064+ * isTruncated: "Boolean" (default: false)
20652065+20662066+ This is true if the "value" has been truncated.
20672067+20682068+ See the Security Considerations section for issues related to
20692069+ truncation and heuristic determination of the content-type and
20702070+ charset.
20712071+20722072+20732073+20742074+Jenkins & Newman Standards Track [Page 37]
20752075+20762076+RFC 8621 JMAP Mail August 2019
20772077+20782078+20792079+ o textBody: "EmailBodyPart[]" (immutable)
20802080+20812081+ A list of "text/plain", "text/html", "image/*", "audio/*", and/or
20822082+ "video/*" parts to display (sequentially) as the message body,
20832083+ with a preference for "text/plain" when alternative versions are
20842084+ available.
20852085+20862086+ o htmlBody: "EmailBodyPart[]" (immutable)
20872087+20882088+ A list of "text/plain", "text/html", "image/*", "audio/*", and/or
20892089+ "video/*" parts to display (sequentially) as the message body,
20902090+ with a preference for "text/html" when alternative versions are
20912091+ available.
20922092+20932093+ o attachments: "EmailBodyPart[]" (immutable)
20942094+20952095+ A list, traversing depth-first, of all parts in "bodyStructure"
20962096+ that satisfy either of the following conditions:
20972097+20982098+ * not of type "multipart/*" and not included in "textBody" or
20992099+ "htmlBody"
21002100+21012101+ * of type "image/*", "audio/*", or "video/*" and not in both
21022102+ "textBody" and "htmlBody"
21032103+21042104+ None of these parts include subParts, including "message/*" types.
21052105+ Attached messages may be fetched using the "Email/parse" method
21062106+ and the "blobId".
21072107+21082108+ Note that a "text/html" body part [HTML] may reference image parts
21092109+ in attachments by using "cid:" links to reference the Content-Id,
21102110+ as defined in [RFC2392], or by referencing the Content-Location.
21112111+21122112+ o hasAttachment: "Boolean" (immutable; server-set)
21132113+21142114+ This is true if there are one or more parts in the message that a
21152115+ client UI should offer as downloadable. A server SHOULD set
21162116+ hasAttachment to true if the "attachments" list contains at least
21172117+ one item that does not have "Content-Disposition: inline". The
21182118+ server MAY ignore parts in this list that are processed
21192119+ automatically in some way or are referenced as embedded images in
21202120+ one of the "text/html" parts of the message.
21212121+21222122+ The server MAY set hasAttachment based on implementation-defined
21232123+ or site-configurable heuristics.
21242124+21252125+21262126+21272127+21282128+21292129+21302130+Jenkins & Newman Standards Track [Page 38]
21312131+21322132+RFC 8621 JMAP Mail August 2019
21332133+21342134+21352135+ o preview: "String" (immutable; server-set)
21362136+21372137+ A plaintext fragment of the message body. This is intended to be
21382138+ shown as a preview line when listing messages in the mail store
21392139+ and may be truncated when shown. The server may choose which part
21402140+ of the message to include in the preview; skipping quoted sections
21412141+ and salutations and collapsing white space can result in a more
21422142+ useful preview.
21432143+21442144+ This MUST NOT be more than 256 characters in length.
21452145+21462146+ As this is derived from the message content by the server, and the
21472147+ algorithm for doing so could change over time, fetching this for
21482148+ an Email a second time MAY return a different result. However,
21492149+ the previous value is not considered incorrect, and the change
21502150+ SHOULD NOT cause the Email object to be considered as changed by
21512151+ the server.
21522152+21532153+ The exact algorithm for decomposing bodyStructure into textBody,
21542154+ htmlBody, and attachments part lists is not mandated, as this is a
21552155+ quality-of-service implementation issue and likely to require
21562156+ workarounds for malformed content discovered over time. However, the
21572157+ following algorithm (expressed here in JavaScript) is suggested as a
21582158+ starting point, based on real-world experience:
21592159+21602160+ function isInlineMediaType ( type ) {
21612161+ return type.startsWith( 'image/' ) ||
21622162+ type.startsWith( 'audio/' ) ||
21632163+ type.startsWith( 'video/' );
21642164+ }
21652165+21662166+ function parseStructure ( parts, multipartType, inAlternative,
21672167+ htmlBody, textBody, attachments ) {
21682168+21692169+ // For multipartType == alternative
21702170+ let textLength = textBody ? textBody.length : -1;
21712171+ let htmlLength = htmlBody ? htmlBody.length : -1;
21722172+21732173+ for ( let i = 0; i < parts.length; i += 1 ) {
21742174+ let part = parts[i];
21752175+ let isMultipart = part.type.startsWith( 'multipart/' );
21762176+ // Is this a body part rather than an attachment
21772177+ let isInline = part.disposition != "attachment" &&
21782178+ // Must be one of the allowed body types
21792179+ ( part.type == "text/plain" ||
21802180+ part.type == "text/html" ||
21812181+ isInlineMediaType( part.type ) ) &&
21822182+21832183+21842184+21852185+21862186+Jenkins & Newman Standards Track [Page 39]
21872187+21882188+RFC 8621 JMAP Mail August 2019
21892189+21902190+21912191+ // If multipart/related, only the first part can be inline
21922192+ // If a text part with a filename, and not the first item
21932193+ // in the multipart, assume it is an attachment
21942194+ ( i === 0 ||
21952195+ ( multipartType != "related" &&
21962196+ ( isInlineMediaType( part.type ) || !part.name ) ) );
21972197+21982198+ if ( isMultipart ) {
21992199+ let subMultiType = part.type.split( '/' )[1];
22002200+ parseStructure( part.subParts, subMultiType,
22012201+ inAlternative || ( subMultiType == 'alternative' ),
22022202+ htmlBody, textBody, attachments );
22032203+ } else if ( isInline ) {
22042204+ if ( multipartType == 'alternative' ) {
22052205+ switch ( part.type ) {
22062206+ case 'text/plain':
22072207+ textBody.push( part );
22082208+ break;
22092209+ case 'text/html':
22102210+ htmlBody.push( part );
22112211+ break;
22122212+ default:
22132213+ attachments.push( part );
22142214+ break;
22152215+ }
22162216+ continue;
22172217+ } else if ( inAlternative ) {
22182218+ if ( part.type == 'text/plain' ) {
22192219+ htmlBody = null;
22202220+ }
22212221+ if ( part.type == 'text/html' ) {
22222222+ textBody = null;
22232223+ }
22242224+ }
22252225+ if ( textBody ) {
22262226+ textBody.push( part );
22272227+ }
22282228+ if ( htmlBody ) {
22292229+ htmlBody.push( part );
22302230+ }
22312231+ if ( ( !textBody || !htmlBody ) &&
22322232+ isInlineMediaType( part.type ) ) {
22332233+ attachments.push( part );
22342234+ }
22352235+ } else {
22362236+ attachments.push( part );
22372237+ }
22382238+ }
22392239+22402240+22412241+22422242+Jenkins & Newman Standards Track [Page 40]
22432243+22442244+RFC 8621 JMAP Mail August 2019
22452245+22462246+22472247+ if ( multipartType == 'alternative' && textBody && htmlBody ) {
22482248+ // Found HTML part only
22492249+ if ( textLength == textBody.length &&
22502250+ htmlLength != htmlBody.length ) {
22512251+ for ( let i = htmlLength; i < htmlBody.length; i += 1 ) {
22522252+ textBody.push( htmlBody[i] );
22532253+ }
22542254+ }
22552255+ // Found plaintext part only
22562256+ if ( htmlLength == htmlBody.length &&
22572257+ textLength != textBody.length ) {
22582258+ for ( let i = textLength; i < textBody.length; i += 1 ) {
22592259+ htmlBody.push( textBody[i] );
22602260+ }
22612261+ }
22622262+ }
22632263+ }
22642264+22652265+ // Usage:
22662266+ let htmlBody = [];
22672267+ let textBody = [];
22682268+ let attachments = [];
22692269+22702270+ parseStructure( [ bodyStructure ], 'mixed', false,
22712271+ htmlBody, textBody, attachments );
22722272+22732273+ For instance, consider a message with both text and HTML versions
22742274+ that has gone through a list software manager that attaches a header
22752275+ and footer. It might have a MIME structure something like:
22762276+22772277+ multipart/mixed
22782278+ text/plain, content-disposition=inline - A
22792279+ multipart/mixed
22802280+ multipart/alternative
22812281+ multipart/mixed
22822282+ text/plain, content-disposition=inline - B
22832283+ image/jpeg, content-disposition=inline - C
22842284+ text/plain, content-disposition=inline - D
22852285+ multipart/related
22862286+ text/html - E
22872287+ image/jpeg - F
22882288+ image/jpeg, content-disposition=attachment - G
22892289+ application/x-excel - H
22902290+ message/rfc822 - J
22912291+ text/plain, content-disposition=inline - K
22922292+22932293+22942294+22952295+22962296+22972297+22982298+Jenkins & Newman Standards Track [Page 41]
22992299+23002300+RFC 8621 JMAP Mail August 2019
23012301+23022302+23032303+ In this case, the above algorithm would decompose this to:
23042304+23052305+ textBody => [ A, B, C, D, K ]
23062306+ htmlBody => [ A, E, K ]
23072307+ attachments => [ C, F, G, H, J ]
23082308+23092309+4.2. Email/get
23102310+23112311+ This is a standard "/get" method as described in [RFC8620],
23122312+ Section 5.1 with the following additional request arguments:
23132313+23142314+ o bodyProperties: "String[]"
23152315+23162316+ A list of properties to fetch for each EmailBodyPart returned. If
23172317+ omitted, this defaults to:
23182318+23192319+ [ "partId", "blobId", "size", "name", "type", "charset",
23202320+ "disposition", "cid", "language", "location" ]
23212321+23222322+ o fetchTextBodyValues: "Boolean" (default: false)
23232323+23242324+ If true, the "bodyValues" property includes any "text/*" part in
23252325+ the "textBody" property.
23262326+23272327+ o fetchHTMLBodyValues: "Boolean" (default: false)
23282328+23292329+ If true, the "bodyValues" property includes any "text/*" part in
23302330+ the "htmlBody" property.
23312331+23322332+ o fetchAllBodyValues: "Boolean" (default: false)
23332333+23342334+ If true, the "bodyValues" property includes any "text/*" part in
23352335+ the "bodyStructure" property.
23362336+23372337+ o maxBodyValueBytes: "UnsignedInt" (default: 0)
23382338+23392339+ If greater than zero, the "value" property of any EmailBodyValue
23402340+ object returned in "bodyValues" MUST be truncated if necessary so
23412341+ it does not exceed this number of octets in size. If 0 (the
23422342+ default), no truncation occurs.
23432343+23442344+ The server MUST ensure the truncation results in valid UTF-8 and
23452345+ does not occur mid-codepoint. If the part is of type "text/html",
23462346+ the server SHOULD NOT truncate inside an HTML tag, e.g., in the
23472347+ middle of "<a href="https://example.com">". There is no
23482348+ requirement for the truncated form to be a balanced tree or valid
23492349+ HTML (indeed, the original source may well be neither of these
23502350+ things).
23512351+23522352+23532353+23542354+Jenkins & Newman Standards Track [Page 42]
23552355+23562356+RFC 8621 JMAP Mail August 2019
23572357+23582358+23592359+ If the standard "properties" argument is omitted or null, the
23602360+ following default MUST be used instead of "all" properties:
23612361+23622362+ [ "id", "blobId", "threadId", "mailboxIds", "keywords", "size",
23632363+ "receivedAt", "messageId", "inReplyTo", "references", "sender", "from",
23642364+ "to", "cc", "bcc", "replyTo", "subject", "sentAt", "hasAttachment",
23652365+ "preview", "bodyValues", "textBody", "htmlBody", "attachments" ]
23662366+23672367+ The following properties are expected to be fast to fetch in a
23682368+ quality implementation:
23692369+23702370+ o id
23712371+23722372+ o blobId
23732373+23742374+ o threadId
23752375+23762376+ o mailboxIds
23772377+23782378+ o keywords
23792379+23802380+ o size
23812381+23822382+ o receivedAt
23832383+23842384+ o messageId
23852385+23862386+ o inReplyTo
23872387+23882388+ o sender
23892389+23902390+ o from
23912391+23922392+ o to
23932393+23942394+ o cc
23952395+23962396+ o bcc
23972397+23982398+ o replyTo
23992399+24002400+ o subject
24012401+24022402+ o sentAt
24032403+24042404+ o hasAttachment
24052405+24062406+ o preview
24072407+24082408+24092409+24102410+Jenkins & Newman Standards Track [Page 43]
24112411+24122412+RFC 8621 JMAP Mail August 2019
24132413+24142414+24152415+ Clients SHOULD take care when fetching any other properties, as there
24162416+ may be significantly longer latency in fetching and returning the
24172417+ data.
24182418+24192419+ As specified above, parsed forms of headers may only be used on
24202420+ appropriate header fields. Attempting to fetch a form that is
24212421+ forbidden (e.g., "header:From:asDate") MUST result in the method call
24222422+ being rejected with an "invalidArguments" error.
24232423+24242424+ Where a specific header field is requested as a property, the
24252425+ capitalization of the property name in the response MUST be identical
24262426+ to that used in the request.
24272427+24282428+4.2.1. Example
24292429+24302430+ Request:
24312431+24322432+ [[ "Email/get", {
24332433+ "ids": [ "f123u456", "f123u457" ],
24342434+ "properties": [ "threadId", "mailboxIds", "from", "subject",
24352435+ "receivedAt", "header:List-POST:asURLs",
24362436+ "htmlBody", "bodyValues" ],
24372437+ "bodyProperties": [ "partId", "blobId", "size", "type" ],
24382438+ "fetchHTMLBodyValues": true,
24392439+ "maxBodyValueBytes": 256
24402440+ }, "#1" ]]
24412441+24422442+ and response:
24432443+24442444+ [[ "Email/get", {
24452445+ "accountId": "abc",
24462446+ "state": "41234123231",
24472447+ "list": [
24482448+ {
24492449+ "id": "f123u457",
24502450+ "threadId": "ef1314a",
24512451+ "mailboxIds": { "f123": true },
24522452+ "from": [{ "name": "Joe Bloggs", "email": "joe@example.com" }],
24532453+ "subject": "Dinner on Thursday?",
24542454+ "receivedAt": "2013-10-13T14:12:00Z",
24552455+ "header:List-POST:asURLs": [
24562456+ "mailto:partytime@lists.example.com"
24572457+ ],
24582458+ "htmlBody": [{
24592459+ "partId": "1",
24602460+ "blobId": "B841623871",
24612461+ "size": 283331,
24622462+ "type": "text/html"
24632463+24642464+24652465+24662466+Jenkins & Newman Standards Track [Page 44]
24672467+24682468+RFC 8621 JMAP Mail August 2019
24692469+24702470+24712471+ }, {
24722472+ "partId": "2",
24732473+ "blobId": "B319437193",
24742474+ "size": 10343,
24752475+ "type": "text/plain"
24762476+ }],
24772477+ "bodyValues": {
24782478+ "1": {
24792479+ "isEncodingProblem": false,
24802480+ "isTruncated": true,
24812481+ "value": "<html><body><p>Hello ..."
24822482+ },
24832483+ "2": {
24842484+ "isEncodingProblem": false,
24852485+ "isTruncated": false,
24862486+ "value": "-- Sent by your friendly mailing list ..."
24872487+ }
24882488+ }
24892489+ }
24902490+ ],
24912491+ "notFound": [ "f123u456" ]
24922492+ }, "#1" ]]
24932493+24942494+4.3. Email/changes
24952495+24962496+ This is a standard "/changes" method as described in [RFC8620],
24972497+ Section 5.2. If generating intermediate states for a large set of
24982498+ changes, it is recommended that newer changes be returned first, as
24992499+ these are generally of more interest to users.
25002500+25012501+4.4. Email/query
25022502+25032503+ This is a standard "/query" method as described in [RFC8620],
25042504+ Section 5.5 but with the following additional request arguments:
25052505+25062506+ o collapseThreads: "Boolean" (default: false)
25072507+25082508+ If true, Emails in the same Thread as a previous Email in the list
25092509+ (given the filter and sort order) will be removed from the list.
25102510+ This means only one Email at most will be included in the list for
25112511+ any given Thread.
25122512+25132513+ In quality implementations, the query "total" property is expected to
25142514+ be fast to calculate when the filter consists solely of a single
25152515+ "inMailbox" property, as it is the same as the totalEmails or
25162516+ totalThreads properties (depending on whether collapseThreads is
25172517+ true) of the associated Mailbox object.
25182518+25192519+25202520+25212521+25222522+Jenkins & Newman Standards Track [Page 45]
25232523+25242524+RFC 8621 JMAP Mail August 2019
25252525+25262526+25272527+4.4.1. Filtering
25282528+25292529+ A *FilterCondition* object has the following properties, any of which
25302530+ may be omitted:
25312531+25322532+ o inMailbox: "Id"
25332533+25342534+ A Mailbox id. An Email must be in this Mailbox to match the
25352535+ condition.
25362536+25372537+ o inMailboxOtherThan: "Id[]"
25382538+25392539+ A list of Mailbox ids. An Email must be in at least one Mailbox
25402540+ not in this list to match the condition. This is to allow
25412541+ messages solely in trash/spam to be easily excluded from a search.
25422542+25432543+ o before: "UTCDate"
25442544+25452545+ The "receivedAt" date-time of the Email must be before this date-
25462546+ time to match the condition.
25472547+25482548+ o after: "UTCDate"
25492549+25502550+ The "receivedAt" date-time of the Email must be the same or after
25512551+ this date-time to match the condition.
25522552+25532553+ o minSize: "UnsignedInt"
25542554+25552555+ The "size" property of the Email must be equal to or greater than
25562556+ this number to match the condition.
25572557+25582558+ o maxSize: "UnsignedInt"
25592559+25602560+ The "size" property of the Email must be less than this number to
25612561+ match the condition.
25622562+25632563+ o allInThreadHaveKeyword: "String"
25642564+25652565+ All Emails (including this one) in the same Thread as this Email
25662566+ must have the given keyword to match the condition.
25672567+25682568+ o someInThreadHaveKeyword: "String"
25692569+25702570+ At least one Email (possibly this one) in the same Thread as this
25712571+ Email must have the given keyword to match the condition.
25722572+25732573+25742574+25752575+25762576+25772577+25782578+Jenkins & Newman Standards Track [Page 46]
25792579+25802580+RFC 8621 JMAP Mail August 2019
25812581+25822582+25832583+ o noneInThreadHaveKeyword: "String"
25842584+25852585+ All Emails (including this one) in the same Thread as this Email
25862586+ must *not* have the given keyword to match the condition.
25872587+25882588+ o hasKeyword: "String"
25892589+25902590+ This Email must have the given keyword to match the condition.
25912591+25922592+ o notKeyword: "String"
25932593+25942594+ This Email must not have the given keyword to match the condition.
25952595+25962596+ o hasAttachment: "Boolean"
25972597+25982598+ The "hasAttachment" property of the Email must be identical to the
25992599+ value given to match the condition.
26002600+26012601+ o text: "String"
26022602+26032603+ Looks for the text in Emails. The server MUST look up text in the
26042604+ From, To, Cc, Bcc, and Subject header fields of the message and
26052605+ SHOULD look inside any "text/*" or other body parts that may be
26062606+ converted to text by the server. The server MAY extend the search
26072607+ to any additional textual property.
26082608+26092609+ o from: "String"
26102610+26112611+ Looks for the text in the From header field of the message.
26122612+26132613+ o to: "String"
26142614+26152615+ Looks for the text in the To header field of the message.
26162616+26172617+ o cc: "String"
26182618+26192619+ Looks for the text in the Cc header field of the message.
26202620+26212621+ o bcc: "String"
26222622+26232623+ Looks for the text in the Bcc header field of the message.
26242624+26252625+ o subject: "String"
26262626+26272627+ Looks for the text in the Subject header field of the message.
26282628+26292629+26302630+26312631+26322632+26332633+26342634+Jenkins & Newman Standards Track [Page 47]
26352635+26362636+RFC 8621 JMAP Mail August 2019
26372637+26382638+26392639+ o body: "String"
26402640+26412641+ Looks for the text in one of the body parts of the message. The
26422642+ server MAY exclude MIME body parts with content media types other
26432643+ than "text/*" and "message/*" from consideration in search
26442644+ matching. Care should be taken to match based on the text content
26452645+ actually presented to an end user by viewers for that media type
26462646+ or otherwise identified as appropriate for search indexing.
26472647+ Matching document metadata uninteresting to an end user (e.g.,
26482648+ markup tag and attribute names) is undesirable.
26492649+26502650+ o header: "String[]"
26512651+26522652+ The array MUST contain either one or two elements. The first
26532653+ element is the name of the header field to match against. The
26542654+ second (optional) element is the text to look for in the header
26552655+ field value. If not supplied, the message matches simply if it
26562656+ has a header field of the given name.
26572657+26582658+ If zero properties are specified on the FilterCondition, the
26592659+ condition MUST always evaluate to true. If multiple properties are
26602660+ specified, ALL must apply for the condition to be true (it is
26612661+ equivalent to splitting the object into one-property conditions and
26622662+ making them all the child of an AND filter operator).
26632663+26642664+ The exact semantics for matching "String" fields is *deliberately not
26652665+ defined* to allow for flexibility in indexing implementation, subject
26662666+ to the following:
26672667+26682668+ o Any syntactically correct encoded sections [RFC2047] of header
26692669+ fields with a known encoding SHOULD be decoded before attempting
26702670+ to match text.
26712671+26722672+ o When searching inside a "text/html" body part, any text considered
26732673+ markup rather than content SHOULD be ignored, including HTML tags
26742674+ and most attributes, anything inside the "<head>" tag, Cascading
26752675+ Style Sheets (CSS), and JavaScript. Attribute content intended
26762676+ for presentation to the user such as "alt" and "title" SHOULD be
26772677+ considered in the search.
26782678+26792679+ o Text SHOULD be matched in a case-insensitive manner.
26802680+26812681+ o Text contained in either (but matched) single (') or double (")
26822682+ quotes SHOULD be treated as a *phrase search*; that is, a match is
26832683+ required for that exact word or sequence of words, excluding the
26842684+ surrounding quotation marks.
26852685+26862686+26872687+26882688+26892689+26902690+Jenkins & Newman Standards Track [Page 48]
26912691+26922692+RFC 8621 JMAP Mail August 2019
26932693+26942694+26952695+ Within a phrase, to match one of the following characters you MUST
26962696+ escape it by prefixing it with a backslash (\):
26972697+26982698+ ' " \
26992699+27002700+ o Outside of a phrase, white space SHOULD be treated as dividing
27012701+ separate tokens that may be searched for separately but MUST all
27022702+ be present for the Email to match the filter.
27032703+27042704+ o Tokens (not part of a phrase) MAY be matched on a whole-word basis
27052705+ using stemming (for example, a text search for "bus" would match
27062706+ "buses" but not "business").
27072707+27082708+4.4.2. Sorting
27092709+27102710+ The following value for the "property" field on the Comparator object
27112711+ MUST be supported for sorting:
27122712+27132713+ o "receivedAt" - The "receivedAt" date as returned in the Email
27142714+ object.
27152715+27162716+ The following values for the "property" field on the Comparator
27172717+ object SHOULD be supported for sorting. When specifying a
27182718+ "hasKeyword", "allInThreadHaveKeyword", or "someInThreadHaveKeyword"
27192719+ sort, the Comparator object MUST also have a "keyword" property.
27202720+27212721+ o "size" - The "size" as returned in the Email object.
27222722+27232723+ o "from" - This is taken to be either the "name" property or if
27242724+ null/empty, the "email" property of the *first* EmailAddress
27252725+ object in the Email's "from" property. If still none, consider
27262726+ the value to be the empty string.
27272727+27282728+ o "to" - This is taken to be either the "name" property or if null/
27292729+ empty, the "email" property of the *first* EmailAddress object in
27302730+ the Email's "to" property. If still none, consider the value to
27312731+ be the empty string.
27322732+27332733+ o "subject" - This is taken to be the base subject of the message,
27342734+ as defined in Section 2.1 of [RFC5256].
27352735+27362736+ o "sentAt" - The "sentAt" property on the Email object.
27372737+27382738+ o "hasKeyword" - This value MUST be considered true if the Email has
27392739+ the keyword given as an additional "keyword" property on the
27402740+ Comparator object, or false otherwise.
27412741+27422742+27432743+27442744+27452745+27462746+Jenkins & Newman Standards Track [Page 49]
27472747+27482748+RFC 8621 JMAP Mail August 2019
27492749+27502750+27512751+ o "allInThreadHaveKeyword" - This value MUST be considered true for
27522752+ the Email if *all* of the Emails in the same Thread have the
27532753+ keyword given as an additional "keyword" property on the
27542754+ Comparator object.
27552755+27562756+ o "someInThreadHaveKeyword" - This value MUST be considered true for
27572757+ the Email if *any* of the Emails in the same Thread have the
27582758+ keyword given as an additional "keyword" property on the
27592759+ Comparator object.
27602760+27612761+ The server MAY support sorting based on other properties as well. A
27622762+ client can discover which properties are supported by inspecting the
27632763+ account's "capabilities" object (see Section 1.3).
27642764+27652765+ Example sort:
27662766+27672767+ [{
27682768+ "property": "someInThreadHaveKeyword",
27692769+ "keyword": "$flagged",
27702770+ "isAscending": false
27712771+ }, {
27722772+ "property": "subject",
27732773+ "collation": "i;ascii-casemap"
27742774+ }, {
27752775+ "property": "receivedAt",
27762776+ "isAscending": false
27772777+ }]
27782778+27792779+ This would sort Emails in flagged Threads first (the Thread is
27802780+ considered flagged if any Email within it is flagged), in subject
27812781+ order second, and then from newest first for messages with the same
27822782+ subject. If two Emails have identical values for all three
27832783+ properties, then the order is server dependent but must be stable.
27842784+27852785+4.4.3. Thread Collapsing
27862786+27872787+ When "collapseThreads" is true, then after filtering and sorting the
27882788+ Email list, the list is further winnowed by removing any Emails for a
27892789+ Thread id that has already been seen (when passing through the list
27902790+ sequentially). A Thread will therefore only appear *once* in the
27912791+ result, at the position of the first Email in the list that belongs
27922792+ to the Thread (given the current sort/filter).
27932793+27942794+27952795+27962796+27972797+27982798+27992799+28002800+28012801+28022802+Jenkins & Newman Standards Track [Page 50]
28032803+28042804+RFC 8621 JMAP Mail August 2019
28052805+28062806+28072807+4.5. Email/queryChanges
28082808+28092809+ This is a standard "/queryChanges" method as described in [RFC8620],
28102810+ Section 5.6 with the following additional request argument:
28112811+28122812+ o collapseThreads: "Boolean" (default: false)
28132813+28142814+ The "collapseThreads" argument that was used with "Email/query".
28152815+28162816+4.6. Email/set
28172817+28182818+ This is a standard "/set" method as described in [RFC8620],
28192819+ Section 5.3. The "Email/set" method encompasses:
28202820+28212821+ o Creating a draft
28222822+28232823+ o Changing the keywords of an Email (e.g., unread/flagged status)
28242824+28252825+ o Adding/removing an Email to/from Mailboxes (moving a message)
28262826+28272827+ o Deleting Emails
28282828+28292829+ The format of the "keywords"/"mailboxIds" properties means that when
28302830+ updating an Email, you can either replace the entire set of keywords/
28312831+ Mailboxes (by setting the full value of the property) or add/remove
28322832+ individual ones using the JMAP patch syntax (see [RFC8620],
28332833+ Section 5.3 for the specification and Section 5.7 for an example).
28342834+28352835+ Due to the format of the Email object, when creating an Email, there
28362836+ are a number of ways to specify the same information. To ensure that
28372837+ the message [RFC5322] to create is unambiguous, the following
28382838+ constraints apply to Email objects submitted for creation:
28392839+28402840+ o The "headers" property MUST NOT be given on either the top-level
28412841+ Email or an EmailBodyPart -- the client must set each header field
28422842+ as an individual property.
28432843+28442844+ o There MUST NOT be two properties that represent the same header
28452845+ field (e.g., "header:from" and "from") within the Email or
28462846+ particular EmailBodyPart.
28472847+28482848+ o Header fields MUST NOT be specified in parsed forms that are
28492849+ forbidden for that particular field.
28502850+28512851+ o Header fields beginning with "Content-" MUST NOT be specified on
28522852+ the Email object, only on EmailBodyPart objects.
28532853+28542854+28552855+28562856+28572857+28582858+Jenkins & Newman Standards Track [Page 51]
28592859+28602860+RFC 8621 JMAP Mail August 2019
28612861+28622862+28632863+ o If a "bodyStructure" property is given, there MUST NOT be
28642864+ "textBody", "htmlBody", or "attachments" properties.
28652865+28662866+ o If given, the "bodyStructure" EmailBodyPart MUST NOT contain a
28672867+ property representing a header field that is already defined on
28682868+ the top-level Email object.
28692869+28702870+ o If given, textBody MUST contain exactly one body part and it MUST
28712871+ be of type "text/plain".
28722872+28732873+ o If given, htmlBody MUST contain exactly one body part and it MUST
28742874+ be of type "text/html".
28752875+28762876+ o Within an EmailBodyPart:
28772877+28782878+ * The client may specify a partId OR a blobId, but not both. If
28792879+ a partId is given, this partId MUST be present in the
28802880+ "bodyValues" property.
28812881+28822882+ * The "charset" property MUST be omitted if a partId is given
28832883+ (the part's content is included in bodyValues, and the server
28842884+ may choose any appropriate encoding).
28852885+28862886+ * The "size" property MUST be omitted if a partId is given. If a
28872887+ blobId is given, it may be included but is ignored by the
28882888+ server (the size is actually calculated from the blob content
28892889+ itself).
28902890+28912891+ * A Content-Transfer-Encoding header field MUST NOT be given.
28922892+28932893+ o Within an EmailBodyValue object, isEncodingProblem and isTruncated
28942894+ MUST be either false or omitted.
28952895+28962896+ Creation attempts that violate any of this SHOULD be rejected with an
28972897+ "invalidProperties" error; however, a server MAY choose to modify the
28982898+ Email (e.g., choose between conflicting headers, use a different
28992899+ content-encoding, etc.) to comply with its requirements instead.
29002900+29012901+ The server MAY also choose to set additional headers. If not
29022902+ included, the server MUST generate and set a Message-ID header field
29032903+ in conformance with [RFC5322], Section 3.6.4 and a Date header field
29042904+ in conformance with Section 3.6.1.
29052905+29062906+ The final message generated may be invalid per RFC 5322. For
29072907+ example, if it is a half-finished draft, the To header field may have
29082908+ a value that does not conform to the required syntax for this header.
29092909+ The message will be checked for strict conformance when submitted for
29102910+ sending (see the EmailSubmission object description).
29112911+29122912+29132913+29142914+Jenkins & Newman Standards Track [Page 52]
29152915+29162916+RFC 8621 JMAP Mail August 2019
29172917+29182918+29192919+ Destroying an Email removes it from all Mailboxes to which it
29202920+ belonged. To just delete an Email to trash, simply change the
29212921+ "mailboxIds" property, so it is now in the Mailbox with a "role"
29222922+ property equal to "trash", and remove all other Mailbox ids.
29232923+29242924+ When emptying the trash, clients SHOULD NOT destroy Emails that are
29252925+ also in a Mailbox other than trash. For those Emails, they SHOULD
29262926+ just remove the trash Mailbox from the Email.
29272927+29282928+ For successfully created Email objects, the "created" response
29292929+ contains the "id", "blobId", "threadId", and "size" properties of the
29302930+ object.
29312931+29322932+ The following extra SetError types are defined:
29332933+29342934+ For "create":
29352935+29362936+ o "blobNotFound": At least one blob id given for an EmailBodyPart
29372937+ doesn't exist. An extra "notFound" property of type "Id[]" MUST
29382938+ be included in the SetError object containing every "blobId"
29392939+ referenced by an EmailBodyPart that could not be found on the
29402940+ server.
29412941+29422942+ For "create" and "update":
29432943+29442944+ o "tooManyKeywords": The change to the Email's keywords would exceed
29452945+ a server-defined maximum.
29462946+29472947+ o "tooManyMailboxes": The change to the set of Mailboxes that this
29482948+ Email is in would exceed a server-defined maximum.
29492949+29502950+4.7. Email/copy
29512951+29522952+ This is a standard "/copy" method as described in [RFC8620],
29532953+ Section 5.4, except only the "mailboxIds", "keywords", and
29542954+ "receivedAt" properties may be set during the copy. This method
29552955+ cannot modify the message represented by the Email.
29562956+29572957+ The server MAY forbid two Email objects with identical message
29582958+ content [RFC5322], or even just with the same Message-ID [RFC5322],
29592959+ to coexist within an account; if the target account already has the
29602960+ Email, the copy will be rejected with a standard "alreadyExists"
29612961+ error.
29622962+29632963+ For successfully copied Email objects, the "created" response
29642964+ contains the "id", "blobId", "threadId", and "size" properties of the
29652965+ new object.
29662966+29672967+29682968+29692969+29702970+Jenkins & Newman Standards Track [Page 53]
29712971+29722972+RFC 8621 JMAP Mail August 2019
29732973+29742974+29752975+4.8. Email/import
29762976+29772977+ The "Email/import" method adds messages [RFC5322] to the set of
29782978+ Emails in an account. The server MUST support messages with Email
29792979+ Address Internationalization (EAI) headers [RFC6532]. The messages
29802980+ must first be uploaded as blobs using the standard upload mechanism.
29812981+ The method takes the following arguments:
29822982+29832983+ o accountId: "Id"
29842984+29852985+ The id of the account to use.
29862986+29872987+ o ifInState: "String|null"
29882988+29892989+ This is a state string as returned by the "Email/get" method. If
29902990+ supplied, the string must match the current state of the account
29912991+ referenced by the accountId; otherwise, the method will be aborted
29922992+ and a "stateMismatch" error returned. If null, any changes will
29932993+ be applied to the current state.
29942994+29952995+ o emails: "Id[EmailImport]"
29962996+29972997+ A map of creation id (client specified) to EmailImport objects.
29982998+29992999+ An *EmailImport* object has the following properties:
30003000+30013001+ o blobId: "Id"
30023002+30033003+ The id of the blob containing the raw message [RFC5322].
30043004+30053005+ o mailboxIds: "Id[Boolean]"
30063006+30073007+ The ids of the Mailboxes to assign this Email to. At least one
30083008+ Mailbox MUST be given.
30093009+30103010+ o keywords: "String[Boolean]" (default: {})
30113011+30123012+ The keywords to apply to the Email.
30133013+30143014+ o receivedAt: "UTCDate" (default: time of most recent Received
30153015+ header, or time of import on server if none)
30163016+30173017+ The "receivedAt" date to set on the Email.
30183018+30193019+ Each Email to import is considered an atomic unit that may succeed or
30203020+ fail individually. Importing successfully creates a new Email object
30213021+ from the data referenced by the blobId and applies the given
30223022+ Mailboxes, keywords, and receivedAt date.
30233023+30243024+30253025+30263026+Jenkins & Newman Standards Track [Page 54]
30273027+30283028+RFC 8621 JMAP Mail August 2019
30293029+30303030+30313031+ The server MAY forbid two Email objects with the same exact content
30323032+ [RFC5322], or even just with the same Message-ID [RFC5322], to
30333033+ coexist within an account. In this case, it MUST reject attempts to
30343034+ import an Email considered to be a duplicate with an "alreadyExists"
30353035+ SetError. An "existingId" property of type "Id" MUST be included on
30363036+ the SetError object with the id of the existing Email. If duplicates
30373037+ are allowed, the newly created Email object MUST have a separate id
30383038+ and independent mutable properties to the existing object.
30393039+30403040+ If the "blobId", "mailboxIds", or "keywords" properties are invalid
30413041+ (e.g., missing, wrong type, id not found), the server MUST reject the
30423042+ import with an "invalidProperties" SetError.
30433043+30443044+ If the Email cannot be imported because it would take the account
30453045+ over quota, the import should be rejected with an "overQuota"
30463046+ SetError.
30473047+30483048+ If the blob referenced is not a valid message [RFC5322], the server
30493049+ MAY modify the message to fix errors (such as removing NUL octets or
30503050+ fixing invalid headers). If it does this, the "blobId" on the
30513051+ response MUST represent the new representation and therefore be
30523052+ different to the "blobId" on the EmailImport object. Alternatively,
30533053+ the server MAY reject the import with an "invalidEmail" SetError.
30543054+30553055+ The response has the following arguments:
30563056+30573057+ o accountId: "Id"
30583058+30593059+ The id of the account used for this call.
30603060+30613061+ o oldState: "String|null"
30623062+30633063+ The state string that would have been returned by "Email/get" on
30643064+ this account before making the requested changes, or null if the
30653065+ server doesn't know what the previous state string was.
30663066+30673067+ o newState: "String"
30683068+30693069+ The state string that will now be returned by "Email/get" on this
30703070+ account.
30713071+30723072+ o created: "Id[Email]|null"
30733073+30743074+ A map of the creation id to an object containing the "id",
30753075+ "blobId", "threadId", and "size" properties for each successfully
30763076+ imported Email, or null if none.
30773077+30783078+30793079+30803080+30813081+30823082+Jenkins & Newman Standards Track [Page 55]
30833083+30843084+RFC 8621 JMAP Mail August 2019
30853085+30863086+30873087+ o notCreated: "Id[SetError]|null"
30883088+30893089+ A map of the creation id to a SetError object for each Email that
30903090+ failed to be created, or null if all successful. The possible
30913091+ errors are defined above.
30923092+30933093+ The following additional errors may be returned instead of the
30943094+ "Email/import" response:
30953095+30963096+ "stateMismatch": An "ifInState" argument was supplied, and it does
30973097+ not match the current state.
30983098+30993099+4.9. Email/parse
31003100+31013101+ This method allows you to parse blobs as messages [RFC5322] to get
31023102+ Email objects. The server MUST support messages with EAI headers
31033103+ [RFC6532]. This can be used to parse and display attached messages
31043104+ without having to import them as top-level Email objects in the mail
31053105+ store in their own right.
31063106+31073107+ The following metadata properties on the Email objects will be null
31083108+ if requested:
31093109+31103110+ o id
31113111+31123112+ o mailboxIds
31133113+31143114+ o keywords
31153115+31163116+ o receivedAt
31173117+31183118+ The "threadId" property of the Email MAY be present if the server can
31193119+ calculate which Thread the Email would be assigned to were it to be
31203120+ imported. Otherwise, this too is null if fetched.
31213121+31223122+ The "Email/parse" method takes the following arguments:
31233123+31243124+ o accountId: "Id"
31253125+31263126+ The id of the account to use.
31273127+31283128+ o blobIds: "Id[]"
31293129+31303130+ The ids of the blobs to parse.
31313131+31323132+31333133+31343134+31353135+31363136+31373137+31383138+Jenkins & Newman Standards Track [Page 56]
31393139+31403140+RFC 8621 JMAP Mail August 2019
31413141+31423142+31433143+ o properties: "String[]"
31443144+31453145+ If supplied, only the properties listed in the array are returned
31463146+ for each Email object. If omitted, defaults to:
31473147+31483148+ [ "messageId", "inReplyTo", "references", "sender", "from", "to",
31493149+ "cc", "bcc", "replyTo", "subject", "sentAt", "hasAttachment",
31503150+ "preview", "bodyValues", "textBody", "htmlBody", "attachments" ]
31513151+31523152+ o bodyProperties: "String[]"
31533153+31543154+ A list of properties to fetch for each EmailBodyPart returned. If
31553155+ omitted, defaults to the same value as the "Email/get"
31563156+ "bodyProperties" default argument.
31573157+31583158+ o fetchTextBodyValues: "Boolean" (default: false)
31593159+31603160+ If true, the "bodyValues" property includes any "text/*" part in
31613161+ the "textBody" property.
31623162+31633163+ o fetchHTMLBodyValues: "Boolean" (default: false)
31643164+31653165+ If true, the "bodyValues" property includes any "text/*" part in
31663166+ the "htmlBody" property.
31673167+31683168+ o fetchAllBodyValues: "Boolean" (default: false)
31693169+31703170+ If true, the "bodyValues" property includes any "text/*" part in
31713171+ the "bodyStructure" property.
31723172+31733173+ o maxBodyValueBytes: "UnsignedInt" (default: 0)
31743174+31753175+ If greater than zero, the "value" property of any EmailBodyValue
31763176+ object returned in "bodyValues" MUST be truncated if necessary so
31773177+ it does not exceed this number of octets in size. If 0 (the
31783178+ default), no truncation occurs.
31793179+31803180+ The server MUST ensure the truncation results in valid UTF-8 and
31813181+ does not occur mid-codepoint. If the part is of type "text/html",
31823182+ the server SHOULD NOT truncate inside an HTML tag, e.g., in the
31833183+ middle of "<a href="https://example.com">". There is no
31843184+ requirement for the truncated form to be a balanced tree or valid
31853185+ HTML (indeed, the original source may well be neither of these
31863186+ things).
31873187+31883188+31893189+31903190+31913191+31923192+31933193+31943194+Jenkins & Newman Standards Track [Page 57]
31953195+31963196+RFC 8621 JMAP Mail August 2019
31973197+31983198+31993199+ The response has the following arguments:
32003200+32013201+ o accountId: "Id"
32023202+32033203+ The id of the account used for the call.
32043204+32053205+ o parsed: "Id[Email]|null"
32063206+32073207+ A map of blob id to parsed Email representation for each
32083208+ successfully parsed blob, or null if none.
32093209+32103210+ o notParsable: "Id[]|null"
32113211+32123212+ A list of ids given that corresponded to blobs that could not be
32133213+ parsed as Emails, or null if none.
32143214+32153215+ o notFound: "Id[]|null"
32163216+32173217+ A list of blob ids given that could not be found, or null if none.
32183218+32193219+ As specified above, parsed forms of headers may only be used on
32203220+ appropriate header fields. Attempting to fetch a form that is
32213221+ forbidden (e.g., "header:From:asDate") MUST result in the method call
32223222+ being rejected with an "invalidArguments" error.
32233223+32243224+ Where a specific header field is requested as a property, the
32253225+ capitalization of the property name in the response MUST be identical
32263226+ to that used in the request.
32273227+32283228+4.10. Examples
32293229+32303230+ A client logs in for the first time. It first fetches the set of
32313231+ Mailboxes. Now it will display the inbox to the user, which we will
32323232+ presume has Mailbox id "fb666a55". The inbox may be (very!) large,
32333233+ but the user's screen is only so big, so the client can just load the
32343234+ Threads it needs to fill the screen and then load in more only when
32353235+ the user scrolls. The client sends this request:
32363236+32373237+ [[ "Email/query",{
32383238+ "accountId": "ue150411c",
32393239+ "filter": {
32403240+ "inMailbox": "fb666a55"
32413241+ },
32423242+ "sort": [{
32433243+ "isAscending": false,
32443244+ "property": "receivedAt"
32453245+ }],
32463246+ "collapseThreads": true,
32473247+32483248+32493249+32503250+Jenkins & Newman Standards Track [Page 58]
32513251+32523252+RFC 8621 JMAP Mail August 2019
32533253+32543254+32553255+ "position": 0,
32563256+ "limit": 30,
32573257+ "calculateTotal": true
32583258+ }, "0" ],
32593259+ [ "Email/get", {
32603260+ "accountId": "ue150411c",
32613261+ "#ids": {
32623262+ "resultOf": "0",
32633263+ "name": "Email/query",
32643264+ "path": "/ids"
32653265+ },
32663266+ "properties": [
32673267+ "threadId"
32683268+ ]
32693269+ }, "1" ],
32703270+ [ "Thread/get", {
32713271+ "accountId": "ue150411c",
32723272+ "#ids": {
32733273+ "resultOf": "1",
32743274+ "name": "Email/get",
32753275+ "path": "/list/*/threadId"
32763276+ }
32773277+ }, "2" ],
32783278+ [ "Email/get", {
32793279+ "accountId": "ue150411c",
32803280+ "#ids": {
32813281+ "resultOf": "2",
32823282+ "name": "Thread/get",
32833283+ "path": "/list/*/emailIds"
32843284+ },
32853285+ "properties": [
32863286+ "threadId",
32873287+ "mailboxIds",
32883288+ "keywords",
32893289+ "hasAttachment",
32903290+ "from",
32913291+ "subject",
32923292+ "receivedAt",
32933293+ "size",
32943294+ "preview"
32953295+ ]
32963296+ }, "3" ]]
32973297+32983298+32993299+33003300+33013301+33023302+33033303+33043304+33053305+33063306+Jenkins & Newman Standards Track [Page 59]
33073307+33083308+RFC 8621 JMAP Mail August 2019
33093309+33103310+33113311+ Let's break down the 4 method calls to see what they're doing:
33123312+33133313+ "0": This asks the server for the ids of the first 30 Email objects
33143314+ in the inbox, sorted newest first, ignoring Emails from the same
33153315+ Thread as a newer Email in the Mailbox (i.e., it is the first 30
33163316+ unique Threads).
33173317+33183318+ "1": Now we use a back-reference to fetch the Thread ids for each of
33193319+ these Email ids.
33203320+33213321+ "2": Another back-reference fetches the Thread object for each of
33223322+ these Thread ids.
33233323+33243324+ "3": Finally, we fetch the information we need to display the Mailbox
33253325+ listing (but no more!) for every Email in each of these 30 Threads.
33263326+ The client may aggregate this data for display, for example, by
33273327+ showing the Thread as "flagged" if any of the Emails in it has the
33283328+ "$flagged" keyword.
33293329+33303330+ The response from the server may look something like this:
33313331+33323332+ [[ "Email/query", {
33333333+ "accountId": "ue150411c",
33343334+ "queryState": "09aa9a075588-780599:0",
33353335+ "canCalculateChanges": true,
33363336+ "position": 0,
33373337+ "total": 115,
33383338+ "ids": [ "Ma783e5cdf5f2deffbc97930a",
33393339+ "M9bd17497e2a99cb345fc1d0a", ... ]
33403340+ }, "0" ],
33413341+ [ "Email/get", {
33423342+ "accountId": "ue150411c",
33433343+ "state": "780599",
33443344+ "list": [{
33453345+ "id": "Ma783e5cdf5f2deffbc97930a",
33463346+ "threadId": "T36703c2cfe9bd5ed"
33473347+ }, {
33483348+ "id": "M9bd17497e2a99cb345fc1d0a",
33493349+ "threadId": "T0a22ad76e9c097a1"
33503350+ }, ... ],
33513351+ "notFound": []
33523352+ }, "1" ],
33533353+ [ "Thread/get", {
33543354+ "accountId": "ue150411c",
33553355+ "state": "22a8728b",
33563356+ "list": [{
33573357+ "id": "T36703c2cfe9bd5ed",
33583358+ "emailIds": [ "Ma783e5cdf5f2deffbc97930a" ]
33593359+33603360+33613361+33623362+Jenkins & Newman Standards Track [Page 60]
33633363+33643364+RFC 8621 JMAP Mail August 2019
33653365+33663366+33673367+ }, {
33683368+ "id": "T0a22ad76e9c097a1",
33693369+ "emailIds": [ "M3b568670a63e5d100f518fa5",
33703370+ "M9bd17497e2a99cb345fc1d0a" ]
33713371+ }, ... ],
33723372+ "notFound": []
33733373+ }, "2" ],
33743374+ [ "Email/get", {
33753375+ "accountId": "ue150411c",
33763376+ "state": "780599",
33773377+ "list": [{
33783378+ "id": "Ma783e5cdf5f2deffbc97930a",
33793379+ "threadId": "T36703c2cfe9bd5ed",
33803380+ "mailboxIds": {
33813381+ "fb666a55": true
33823382+ },
33833383+ "keywords": {
33843384+ "$seen": true,
33853385+ "$flagged": true
33863386+ },
33873387+ "hasAttachment": true,
33883388+ "from": [{
33893389+ "email": "jdoe@example.com",
33903390+ "name": "Jane Doe"
33913391+ }],
33923392+ "subject": "The Big Reveal",
33933393+ "receivedAt": "2018-06-27T00:20:35Z",
33943394+ "size": 175047,
33953395+ "preview": "As you may be aware, we are required to prepare a
33963396+ presentation where we wow a panel of 5 random members of the
33973397+ public, on or before 30 June each year. We have drafted..."
33983398+ },
33993399+ ...
34003400+ ],
34013401+ "notFound": []
34023402+ }, "3" ]]
34033403+34043404+34053405+34063406+34073407+34083408+34093409+34103410+34113411+34123412+34133413+34143414+34153415+34163416+34173417+34183418+Jenkins & Newman Standards Track [Page 61]
34193419+34203420+RFC 8621 JMAP Mail August 2019
34213421+34223422+34233423+ Now, on another device, the user marks the first Email as unread,
34243424+ sending this API request:
34253425+34263426+ [[ "Email/set", {
34273427+ "accountId": "ue150411c",
34283428+ "update": {
34293429+ "Ma783e5cdf5f2deffbc97930a": {
34303430+ "keywords/$seen": null
34313431+ }
34323432+ }
34333433+ }, "0" ]]
34343434+34353435+ The server applies this and sends the success response:
34363436+34373437+ [[ "Email/set", {
34383438+ "accountId": "ue150411c",
34393439+ "oldState": "780605",
34403440+ "newState": "780606",
34413441+ "updated": {
34423442+ "Ma783e5cdf5f2deffbc97930a": null
34433443+ },
34443444+ ...
34453445+ }, "0" ]]
34463446+34473447+ The user also deletes a few Emails, and then a new message arrives.
34483448+34493449+34503450+34513451+34523452+34533453+34543454+34553455+34563456+34573457+34583458+34593459+34603460+34613461+34623462+34633463+34643464+34653465+34663466+34673467+34683468+34693469+34703470+34713471+34723472+34733473+34743474+Jenkins & Newman Standards Track [Page 62]
34753475+34763476+RFC 8621 JMAP Mail August 2019
34773477+34783478+34793479+ Back on our original machine, we receive a push update that the state
34803480+ string for Email is now "780800". As this does not match the
34813481+ client's current state, it issues a request for the changes:
34823482+34833483+ [[ "Email/changes", {
34843484+ "accountId": "ue150411c",
34853485+ "sinceState": "780605",
34863486+ "maxChanges": 50
34873487+ }, "3" ],
34883488+ [ "Email/queryChanges", {
34893489+ "accountId": "ue150411c",
34903490+ "filter": {
34913491+ "inMailbox": "fb666a55"
34923492+ },
34933493+ "sort": [{
34943494+ "property": "receivedAt",
34953495+ "isAscending": false
34963496+ }],
34973497+ "collapseThreads": true,
34983498+ "sinceQueryState": "09aa9a075588-780599:0",
34993499+ "upToId": "Mc2781d5e856a908d8a35a564",
35003500+ "maxChanges": 25,
35013501+ "calculateTotal": true
35023502+ }, "11" ]]
35033503+35043504+ The response:
35053505+35063506+ [[ "Email/changes", {
35073507+ "accountId": "ue150411c",
35083508+ "oldState": "780605",
35093509+ "newState": "780800",
35103510+ "hasMoreChanges": false,
35113511+ "created": [ "Me8de6c9f6de198239b982ea2" ],
35123512+ "updated": [ "Ma783e5cdf5f2deffbc97930a" ],
35133513+ "destroyed": [ "M9bd17497e2a99cb345fc1d0a", ... ]
35143514+ }, "3" ],
35153515+ [ "Email/queryChanges", {
35163516+ "accountId": "ue150411c",
35173517+ "oldQueryState": "09aa9a075588-780599:0",
35183518+ "newQueryState": "e35e9facf117-780615:0",
35193519+ "added": [{
35203520+ "id": "Me8de6c9f6de198239b982ea2",
35213521+ "index": 0
35223522+ }],
35233523+ "removed": [ "M9bd17497e2a99cb345fc1d0a" ],
35243524+ "total": 115
35253525+ }, "11" ]]
35263526+35273527+35283528+35293529+35303530+Jenkins & Newman Standards Track [Page 63]
35313531+35323532+RFC 8621 JMAP Mail August 2019
35333533+35343534+35353535+ The client can update its local cache of the query results by
35363536+ removing "M9bd17497e2a99cb345fc1d0a" and then splicing in
35373537+ "Me8de6c9f6de198239b982ea2" at position 0. As it does not have the
35383538+ data for this new Email, it will then fetch it (it also could have
35393539+ done this in the same request using back-references).
35403540+35413541+ It knows something has changed about "Ma783e5cdf5f2deffbc97930a", so
35423542+ it will refetch the Mailbox ids and keywords (the only mutable
35433543+ properties) for this Email too.
35443544+35453545+ The user starts composing a new Email. The email is plaintext and
35463546+ the client knows the email in English so adds this metadata to the
35473547+ body part. The user saves a draft while the composition is still in
35483548+ progress. The client sends:
35493549+35503550+ [[ "Email/set", {
35513551+ "accountId": "ue150411c",
35523552+ "create": {
35533553+ "k192": {
35543554+ "mailboxIds": {
35553555+ "2ea1ca41b38e": true
35563556+ },
35573557+ "keywords": {
35583558+ "$seen": true,
35593559+ "$draft": true
35603560+ },
35613561+ "from": [{
35623562+ "name": "Joe Bloggs",
35633563+ "email": "joe@example.com"
35643564+ }],
35653565+ "subject": "World domination",
35663566+ "receivedAt": "2018-07-10T01:03:11Z",
35673567+ "sentAt": "2018-07-10T11:03:11+10:00",
35683568+ "bodyStructure": {
35693569+ "type": "text/plain",
35703570+ "partId": "bd48",
35713571+ "header:Content-Language": "en"
35723572+ },
35733573+ "bodyValues": {
35743574+ "bd48": {
35753575+ "value": "I have the most brilliant plan. Let me tell
35763576+ you all about it. What we do is, we",
35773577+ "isTruncated": false
35783578+ }
35793579+ }
35803580+ }
35813581+ }
35823582+ }, "0" ]]
35833583+35843584+35853585+35863586+Jenkins & Newman Standards Track [Page 64]
35873587+35883588+RFC 8621 JMAP Mail August 2019
35893589+35903590+35913591+ The server creates the message and sends the success response:
35923592+35933593+ [[ "Email/set", {
35943594+ "accountId": "ue150411c",
35953595+ "oldState": "780823",
35963596+ "newState": "780839",
35973597+ "created": {
35983598+ "k192": {
35993599+ "id": "Mf40b5f831efa7233b9eb1c7f",
36003600+ "blobId": "Gf40b5f831efa7233b9eb1c7f8f97d84eeeee64f7",
36013601+ "threadId": "Td957e72e89f516dc",
36023602+ "size": 359
36033603+ }
36043604+ },
36053605+ ...
36063606+ }, "0" ]]
36073607+36083608+ The message created on the server looks something like this:
36093609+36103610+ Message-Id: <bbce0ae9-58be-4b24-ac82-deb840d58016@sloti7d1t02>
36113611+ User-Agent: Cyrus-JMAP/3.1.6-736-gdfb8e44
36123612+ Mime-Version: 1.0
36133613+ Date: Tue, 10 Jul 2018 11:03:11 +1000
36143614+ From: "Joe Bloggs" <joe@example.com>
36153615+ Subject: World domination
36163616+ Content-Language: en
36173617+ Content-Type: text/plain
36183618+36193619+ I have the most brilliant plan. Let me tell you all about it. What we
36203620+ do is, we
36213621+36223622+ The user adds a recipient and converts the message to HTML so they
36233623+ can add formatting, then saves an updated draft:
36243624+36253625+ [[ "Email/set", {
36263626+ "accountId": "ue150411c",
36273627+ "create": {
36283628+ "k1546": {
36293629+ "mailboxIds": {
36303630+ "2ea1ca41b38e": true
36313631+ },
36323632+ "keywords": {
36333633+ "$seen": true,
36343634+ "$draft": true
36353635+ },
36363636+ "from": [{
36373637+ "name": "Joe Bloggs",
36383638+ "email": "joe@example.com"
36393639+36403640+36413641+36423642+Jenkins & Newman Standards Track [Page 65]
36433643+36443644+RFC 8621 JMAP Mail August 2019
36453645+36463646+36473647+ }],
36483648+ "to": [{
36493649+ "name": "John",
36503650+ "email": "john@example.com"
36513651+ }],
36523652+ "subject": "World domination",
36533653+ "receivedAt": "2018-07-10T01:05:08Z",
36543654+ "sentAt": "2018-07-10T11:05:08+10:00",
36553655+ "bodyStructure": {
36563656+ "type": "multipart/alternative",
36573657+ "subParts": [{
36583658+ "partId": "a49d",
36593659+ "type": "text/html",
36603660+ "header:Content-Language": "en"
36613661+ }, {
36623662+ "partId": "bd48",
36633663+ "type": "text/plain",
36643664+ "header:Content-Language": "en"
36653665+ }]
36663666+ },
36673667+ "bodyValues": {
36683668+ "bd48": {
36693669+ "value": "I have the most brilliant plan. Let me tell
36703670+ you all about it. What we do is, we",
36713671+ "isTruncated": false
36723672+ },
36733673+ "a49d": {
36743674+ "value": "<!DOCTYPE html><html><head><title></title>
36753675+ <style type=\"text/css\">div{font-size:16px}</style></head>
36763676+ <body><div>I have the most <b>brilliant</b> plan. Let me
36773677+ tell you all about it. What we do is, we</div></body>
36783678+ </html>",
36793679+ "isTruncated": false
36803680+ }
36813681+ }
36823682+ }
36833683+ },
36843684+ "destroy": [ "Mf40b5f831efa7233b9eb1c7f" ]
36853685+ }, "0" ]]
36863686+36873687+36883688+36893689+36903690+36913691+36923692+36933693+36943694+36953695+36963696+36973697+36983698+Jenkins & Newman Standards Track [Page 66]
36993699+37003700+RFC 8621 JMAP Mail August 2019
37013701+37023702+37033703+ The server creates the new draft, deletes the old one, and sends the
37043704+ success response:
37053705+37063706+ [[ "Email/set", {
37073707+ "accountId": "ue150411c",
37083708+ "oldState": "780839",
37093709+ "newState": "780842",
37103710+ "created": {
37113711+ "k1546": {
37123712+ "id": "Md45b47b4877521042cec0938",
37133713+ "blobId": "Ge8de6c9f6de198239b982ea214e0f3a704e4af74",
37143714+ "threadId": "Td957e72e89f516dc",
37153715+ "size": 11721
37163716+ }
37173717+ },
37183718+ "destroyed": [ "Mf40b5f831efa7233b9eb1c7f" ],
37193719+ ...
37203720+ }, "0" ]]
37213721+37223722+ The client moves this draft to a different account. The only way to
37233723+ do this is via the "Email/copy" method. It MUST set a new
37243724+ "mailboxIds" property, since the current value will not be valid
37253725+ Mailbox ids in the destination account:
37263726+37273727+ [[ "Email/copy", {
37283728+ "fromAccountId": "ue150411c",
37293729+ "accountId": "u6c6c41ac",
37303730+ "create": {
37313731+ "k45": {
37323732+ "id": "Md45b47b4877521042cec0938",
37333733+ "mailboxIds": {
37343734+ "75a4c956": true
37353735+ }
37363736+ }
37373737+ },
37383738+ "onSuccessDestroyOriginal": true
37393739+ }, "0" ]]
37403740+37413741+37423742+37433743+37443744+37453745+37463746+37473747+37483748+37493749+37503750+37513751+37523752+37533753+37543754+Jenkins & Newman Standards Track [Page 67]
37553755+37563756+RFC 8621 JMAP Mail August 2019
37573757+37583758+37593759+ The server successfully copies the Email and deletes the original.
37603760+ Due to the implicit call to "Email/set", there are two responses to
37613761+ the single method call, both with the same method call id:
37623762+37633763+ [[ "Email/copy", {
37643764+ "fromAccountId": "ue150411c",
37653765+ "accountId": "u6c6c41ac",
37663766+ "oldState": "7ee7e9263a6d",
37673767+ "newState": "5a0d2447ed26",
37683768+ "created": {
37693769+ "k45": {
37703770+ "id": "M138f9954a5cd2423daeafa55",
37713771+ "blobId": "G6b9fb047cba722c48c611e79233d057c6b0b74e8",
37723772+ "threadId": "T2f242ea424a4079a",
37733773+ "size": 11721
37743774+ }
37753775+ },
37763776+ "notCreated": null
37773777+ }, "0" ],
37783778+ [ "Email/set", {
37793779+ "accountId": "ue150411c",
37803780+ "oldState": "780842",
37813781+ "newState": "780871",
37823782+ "destroyed": [ "Md45b47b4877521042cec0938" ],
37833783+ ...
37843784+ }, "0" ]]
37853785+37863786+5. Search Snippets
37873787+37883788+ When doing a search on a "String" property, the client may wish to
37893789+ show the relevant section of the body that matches the search as a
37903790+ preview and to highlight any matching terms in both this and the
37913791+ subject of the Email. Search snippets represent this data.
37923792+37933793+ A *SearchSnippet* object has the following properties:
37943794+37953795+ o emailId: "Id"
37963796+37973797+ The Email id the snippet applies to.
37983798+37993799+38003800+38013801+38023802+38033803+38043804+38053805+38063806+38073807+38083808+38093809+38103810+Jenkins & Newman Standards Track [Page 68]
38113811+38123812+RFC 8621 JMAP Mail August 2019
38133813+38143814+38153815+ o subject: "String|null"
38163816+38173817+ If text from the filter matches the subject, this is the subject
38183818+ of the Email with the following transformations:
38193819+38203820+ 1. Any instance of the following three characters MUST be
38213821+ replaced by an appropriate HTML entity: & (ampersand), <
38223822+ (less-than sign), and > (greater-than sign) [HTML]. Other
38233823+ characters MAY also be replaced with an HTML entity form.
38243824+38253825+ 2. The matching words/phrases from the filter are wrapped in HTML
38263826+ "<mark></mark>" tags.
38273827+38283828+ If the subject does not match text from the filter, this property
38293829+ is null.
38303830+38313831+ o preview: "String|null"
38323832+38333833+ If text from the filter matches the plaintext or HTML body, this
38343834+ is the relevant section of the body (converted to plaintext if
38353835+ originally HTML), with the same transformations as the "subject"
38363836+ property. It MUST NOT be bigger than 255 octets in size. If the
38373837+ body does not contain a match for the text from the filter, this
38383838+ property is null.
38393839+38403840+ What is a relevant section of the body for preview is server defined.
38413841+ If the server is unable to determine search snippets, it MUST return
38423842+ null for both the "subject" and "preview" properties.
38433843+38443844+ Note that unlike most data types, a SearchSnippet DOES NOT have a
38453845+ property called "id".
38463846+38473847+ The following JMAP method is supported.
38483848+38493849+5.1. SearchSnippet/get
38503850+38513851+ To fetch search snippets, make a call to "SearchSnippet/get". It
38523852+ takes the following arguments:
38533853+38543854+ o accountId: "Id"
38553855+38563856+ The id of the account to use.
38573857+38583858+ o filter: "FilterOperator|FilterCondition|null"
38593859+38603860+ The same filter as passed to "Email/query"; see the description of
38613861+ this method in Section 4.4 for details.
38623862+38633863+38643864+38653865+38663866+Jenkins & Newman Standards Track [Page 69]
38673867+38683868+RFC 8621 JMAP Mail August 2019
38693869+38703870+38713871+ o emailIds: "Id[]"
38723872+38733873+ The ids of the Emails to fetch snippets for.
38743874+38753875+ The response has the following arguments:
38763876+38773877+ o accountId: "Id"
38783878+38793879+ The id of the account used for the call.
38803880+38813881+ o list: "SearchSnippet[]"
38823882+38833883+ An array of SearchSnippet objects for the requested Email ids.
38843884+ This may not be in the same order as the ids that were in the
38853885+ request.
38863886+38873887+ o notFound: "Id[]|null"
38883888+38893889+ An array of Email ids requested that could not be found, or null
38903890+ if all ids were found.
38913891+38923892+ As the search snippets are derived from the message content and the
38933893+ algorithm for doing so could change over time, fetching the same
38943894+ snippets a second time MAY return a different result. However, the
38953895+ previous value is not considered incorrect, so there is no state
38963896+ string or update mechanism needed.
38973897+38983898+ The following additional errors may be returned instead of the
38993899+ "SearchSnippet/get" response:
39003900+39013901+ "requestTooLarge": The number of "emailIds" requested by the client
39023902+ exceeds the maximum number the server is willing to process in a
39033903+ single method call.
39043904+39053905+ "unsupportedFilter": The server is unable to process the given
39063906+ "filter" for any reason.
39073907+39083908+39093909+39103910+39113911+39123912+39133913+39143914+39153915+39163916+39173917+39183918+39193919+39203920+39213921+39223922+Jenkins & Newman Standards Track [Page 70]
39233923+39243924+RFC 8621 JMAP Mail August 2019
39253925+39263926+39273927+5.2. Example
39283928+39293929+ Here, we did an "Email/query" to search for any Email in the account
39303930+ containing the word "foo"; now, we are fetching the search snippets
39313931+ for some of the ids that were returned in the results:
39323932+39333933+ [[ "SearchSnippet/get", {
39343934+ "accountId": "ue150411c",
39353935+ "filter": {
39363936+ "text": "foo"
39373937+ },
39383938+ "emailIds": [
39393939+ "M44200ec123de277c0c1ce69c",
39403940+ "M7bcbcb0b58d7729686e83d99",
39413941+ "M28d12783a0969584b6deaac0",
39423942+ ...
39433943+ ]
39443944+ }, "0" ]]
39453945+39463946+ Example response:
39473947+39483948+ [[ "SearchSnippet/get", {
39493949+ "accountId": "ue150411c",
39503950+ "list": [{
39513951+ "emailId": "M44200ec123de277c0c1ce69c",
39523952+ "subject": null,
39533953+ "preview": null
39543954+ }, {
39553955+ "emailId": "M7bcbcb0b58d7729686e83d99",
39563956+ "subject": "The <mark>Foo</mark>sball competition",
39573957+ "preview": "...year the <mark>foo</mark>sball competition will
39583958+ be held in the Stadium de ..."
39593959+ }, {
39603960+ "emailId": "M28d12783a0969584b6deaac0",
39613961+ "subject": null,
39623962+ "preview": "...the <mark>Foo</mark>/bar method results often
39633963+ returns <1 widget rather than the complete..."
39643964+ },
39653965+ ...
39663966+ ],
39673967+ "notFound": null
39683968+ }, "0" ]]
39693969+39703970+39713971+39723972+39733973+39743974+39753975+39763976+39773977+39783978+Jenkins & Newman Standards Track [Page 71]
39793979+39803980+RFC 8621 JMAP Mail August 2019
39813981+39823982+39833983+6. Identities
39843984+39853985+ An *Identity* object stores information about an email address or
39863986+ domain the user may send from. It has the following properties:
39873987+39883988+ o id: "Id" (immutable; server-set)
39893989+39903990+ The id of the Identity.
39913991+39923992+ o name: "String" (default: "")
39933993+39943994+ The "From" name the client SHOULD use when creating a new Email
39953995+ from this Identity.
39963996+39973997+ o email: "String" (immutable)
39983998+39993999+ The "From" email address the client MUST use when creating a new
40004000+ Email from this Identity. If the "mailbox" part of the address
40014001+ (the section before the "@") is the single character "*" (e.g.,
40024002+ "*@example.com"), the client may use any valid address ending in
40034003+ that domain (e.g., "foo@example.com").
40044004+40054005+ o replyTo: "EmailAddress[]|null" (default: null)
40064006+40074007+ The Reply-To value the client SHOULD set when creating a new Email
40084008+ from this Identity.
40094009+40104010+ o bcc: "EmailAddress[]|null" (default: null)
40114011+40124012+ The Bcc value the client SHOULD set when creating a new Email from
40134013+ this Identity.
40144014+40154015+ o textSignature: "String" (default: "")
40164016+40174017+ A signature the client SHOULD insert into new plaintext messages
40184018+ that will be sent from this Identity. Clients MAY ignore this
40194019+ and/or combine this with a client-specific signature preference.
40204020+40214021+ o htmlSignature: "String" (default: "")
40224022+40234023+ A signature the client SHOULD insert into new HTML messages that
40244024+ will be sent from this Identity. This text MUST be an HTML
40254025+ snippet to be inserted into the "<body></body>" section of the
40264026+ HTML. Clients MAY ignore this and/or combine this with a client-
40274027+ specific signature preference.
40284028+40294029+40304030+40314031+40324032+40334033+40344034+Jenkins & Newman Standards Track [Page 72]
40354035+40364036+RFC 8621 JMAP Mail August 2019
40374037+40384038+40394039+ o mayDelete: "Boolean" (server-set)
40404040+40414041+ Is the user allowed to delete this Identity? Servers may wish to
40424042+ set this to false for the user's username or other default
40434043+ address. Attempts to destroy an Identity with "mayDelete: false"
40444044+ will be rejected with a standard "forbidden" SetError.
40454045+40464046+ See the "Addresses" header form description in the Email object
40474047+ (Section 4.1.2.3) for the definition of EmailAddress.
40484048+40494049+ Multiple identities with the same email address MAY exist, to allow
40504050+ for different settings the user wants to pick between (for example,
40514051+ with different names/signatures).
40524052+40534053+ The following JMAP methods are supported.
40544054+40554055+6.1. Identity/get
40564056+40574057+ This is a standard "/get" method as described in [RFC8620],
40584058+ Section 5.1. The "ids" argument may be null to fetch all at once.
40594059+40604060+6.2. Identity/changes
40614061+40624062+ This is a standard "/changes" method as described in [RFC8620],
40634063+ Section 5.2.
40644064+40654065+6.3. Identity/set
40664066+40674067+ This is a standard "/set" method as described in [RFC8620],
40684068+ Section 5.3. The following extra SetError types are defined:
40694069+40704070+ For "create":
40714071+40724072+ o "forbiddenFrom": The user is not allowed to send from the address
40734073+ given as the "email" property of the Identity.
40744074+40754075+6.4. Example
40764076+40774077+ Request:
40784078+40794079+ [ "Identity/get", {
40804080+ "accountId": "acme"
40814081+ }, "0" ]
40824082+40834083+40844084+40854085+40864086+40874087+40884088+40894089+40904090+Jenkins & Newman Standards Track [Page 73]
40914091+40924092+RFC 8621 JMAP Mail August 2019
40934093+40944094+40954095+ with response:
40964096+40974097+ [ "Identity/get", {
40984098+ "accountId": "acme",
40994099+ "state": "99401312ae-11-333",
41004100+ "list": [
41014101+ {
41024102+ "id": "XD-3301-222-11_22AAz",
41034103+ "name": "Joe Bloggs",
41044104+ "email": "joe@example.com",
41054105+ "replyTo": null,
41064106+ "bcc": [{
41074107+ "name": null,
41084108+ "email": "joe+archive@example.com"
41094109+ }],
41104110+ "textSignature": "-- \nJoe Bloggs\nMaster of Email",
41114111+ "htmlSignature": "<div><b>Joe Bloggs</b></div>
41124112+ <div>Master of Email</div>",
41134113+ "mayDelete": false
41144114+ },
41154115+ {
41164116+ "id": "XD-9911312-11_22AAz",
41174117+ "name": "Joe B",
41184118+ "email": "*@example.com",
41194119+ "replyTo": null,
41204120+ "bcc": null,
41214121+ "textSignature": "",
41224122+ "htmlSignature": "",
41234123+ "mayDelete": true
41244124+ }
41254125+ ],
41264126+ "notFound": []
41274127+ }, "0" ]
41284128+41294129+7. Email Submission
41304130+41314131+ An *EmailSubmission* object represents the submission of an Email for
41324132+ delivery to one or more recipients. It has the following properties:
41334133+41344134+ o id: "Id" (immutable; server-set)
41354135+41364136+ The id of the EmailSubmission.
41374137+41384138+ o identityId: "Id" (immutable)
41394139+41404140+ The id of the Identity to associate with this submission.
41414141+41424142+41434143+41444144+41454145+41464146+Jenkins & Newman Standards Track [Page 74]
41474147+41484148+RFC 8621 JMAP Mail August 2019
41494149+41504150+41514151+ o emailId: "Id" (immutable)
41524152+41534153+ The id of the Email to send. The Email being sent does not have
41544154+ to be a draft, for example, when "redirecting" an existing Email
41554155+ to a different address.
41564156+41574157+ o threadId: "Id" (immutable; server-set)
41584158+41594159+ The Thread id of the Email to send. This is set by the server to
41604160+ the "threadId" property of the Email referenced by the "emailId".
41614161+41624162+ o envelope: "Envelope|null" (immutable)
41634163+41644164+ Information for use when sending via SMTP. An *Envelope* object
41654165+ has the following properties:
41664166+41674167+ * mailFrom: "Address"
41684168+41694169+ The email address to use as the return address in the SMTP
41704170+ submission, plus any parameters to pass with the MAIL FROM
41714171+ address. The JMAP server MAY allow the address to be the empty
41724172+ string.
41734173+41744174+ When a JMAP server performs an SMTP message submission, it MAY
41754175+ use the same id string for the ENVID parameter [RFC3461] and
41764176+ the EmailSubmission object id. Servers that do this MAY
41774177+ replace a client-provided value for ENVID with a server-
41784178+ provided value.
41794179+41804180+ * rcptTo: "Address[]"
41814181+41824182+ The email addresses to send the message to, and any RCPT TO
41834183+ parameters to pass with the recipient.
41844184+41854185+ An *Address* object has the following properties:
41864186+41874187+ * email: "String"
41884188+41894189+ The email address being represented by the object. This is a
41904190+ "Mailbox" as used in the Reverse-path or Forward-path of the
41914191+ MAIL FROM or RCPT TO command in [RFC5321].
41924192+41934193+ * parameters: "Object|null"
41944194+41954195+ Any parameters to send with the email address (either mail-
41964196+ parameter or rcpt-parameter as appropriate, as specified in
41974197+ [RFC5321]). If supplied, each key in the object is a parameter
41984198+ name, and the value is either the parameter value (type
41994199+42004200+42014201+42024202+Jenkins & Newman Standards Track [Page 75]
42034203+42044204+RFC 8621 JMAP Mail August 2019
42054205+42064206+42074207+ "String") or null if the parameter does not take a value. For
42084208+ both name and value, any xtext or unitext encodings are removed
42094209+ (see [RFC3461] and [RFC6533]) and JSON string encoding is
42104210+ applied.
42114211+42124212+ If the "envelope" property is null or omitted on creation, the
42134213+ server MUST generate this from the referenced Email as follows:
42144214+42154215+ * "mailFrom": The email address in the Sender header field, if
42164216+ present; otherwise, it's the email address in the From header
42174217+ field, if present. In either case, no parameters are added.
42184218+42194219+ If multiple addresses are present in one of these header
42204220+ fields, or there is more than one Sender/From header field, the
42214221+ server SHOULD reject the EmailSubmission as invalid; otherwise,
42224222+ it MUST take the first address in the last Sender/From header
42234223+ field.
42244224+42254225+ If the address found from this is not allowed by the Identity
42264226+ associated with this submission, the "email" property from the
42274227+ Identity MUST be used instead.
42284228+42294229+ * "rcptTo": The deduplicated set of email addresses from the To,
42304230+ Cc, and Bcc header fields, if present, with no parameters for
42314231+ any of them.
42324232+42334233+ o sendAt: "UTCDate" (immutable; server-set)
42344234+42354235+ The date the submission was/will be released for delivery. If the
42364236+ client successfully used FUTURERELEASE [RFC4865] with the
42374237+ submission, this MUST be the time when the server will release the
42384238+ message; otherwise, it MUST be the time the EmailSubmission was
42394239+ created.
42404240+42414241+ o undoStatus: "String"
42424242+42434243+ This represents whether the submission may be canceled. This is
42444244+ server set on create and MUST be one of the following values:
42454245+42464246+ * "pending": It may be possible to cancel this submission.
42474247+42484248+ * "final": The message has been relayed to at least one recipient
42494249+ in a manner that cannot be recalled. It is no longer possible
42504250+ to cancel this submission.
42514251+42524252+ * "canceled": The submission was canceled and will not be
42534253+ delivered to any recipient.
42544254+42554255+42564256+42574257+42584258+Jenkins & Newman Standards Track [Page 76]
42594259+42604260+RFC 8621 JMAP Mail August 2019
42614261+42624262+42634263+ On systems that do not support unsending, the value of this
42644264+ property will always be "final". On systems that do support
42654265+ canceling submission, it will start as "pending" and MAY
42664266+ transition to "final" when the server knows it definitely cannot
42674267+ recall the message, but it MAY just remain "pending". If in
42684268+ pending state, a client can attempt to cancel the submission by
42694269+ setting this property to "canceled"; if the update succeeds, the
42704270+ submission was successfully canceled, and the message has not been
42714271+ delivered to any of the original recipients.
42724272+42734273+ o deliveryStatus: "String[DeliveryStatus]|null" (server-set)
42744274+42754275+ This represents the delivery status for each of the submission's
42764276+ recipients, if known. This property MAY not be supported by all
42774277+ servers, in which case it will remain null. Servers that support
42784278+ it SHOULD update the EmailSubmission object each time the status
42794279+ of any of the recipients changes, even if some recipients are
42804280+ still being retried.
42814281+42824282+ This value is a map from the email address of each recipient to a
42834283+ DeliveryStatus object.
42844284+42854285+ A *DeliveryStatus* object has the following properties:
42864286+42874287+ * smtpReply: "String"
42884288+42894289+ The SMTP reply string returned for this recipient when the
42904290+ server last tried to relay the message, or in a later Delivery
42914291+ Status Notification (DSN, as defined in [RFC3464]) response for
42924292+ the message. This SHOULD be the response to the RCPT TO stage,
42934293+ unless this was accepted and the message as a whole was
42944294+ rejected at the end of the DATA stage, in which case the DATA
42954295+ stage reply SHOULD be used instead.
42964296+42974297+ Multi-line SMTP responses should be concatenated to a single
42984298+ string as follows:
42994299+43004300+ + The hyphen following the SMTP code on all but the last line
43014301+ is replaced with a space.
43024302+43034303+ + Any prefix in common with the first line is stripped from
43044304+ lines after the first.
43054305+43064306+ + CRLF is replaced by a space.
43074307+43084308+43094309+43104310+43114311+43124312+43134313+43144314+Jenkins & Newman Standards Track [Page 77]
43154315+43164316+RFC 8621 JMAP Mail August 2019
43174317+43184318+43194319+ For example:
43204320+43214321+ 550-5.7.1 Our system has detected that this message is
43224322+ 550 5.7.1 likely spam.
43234323+43244324+ would become:
43254325+43264326+ 550 5.7.1 Our system has detected that this message is likely spam.
43274327+43284328+ For messages relayed via an alternative to SMTP, the server MAY
43294329+ generate a synthetic string representing the status instead.
43304330+ If it does this, the string MUST be of the following form:
43314331+43324332+ + A 3-digit SMTP reply code, as defined in [RFC5321],
43334333+ Section 4.2.3.
43344334+43354335+ + Then a single space character.
43364336+43374337+ + Then an SMTP Enhanced Mail System Status Code as defined in
43384338+ [RFC3463], with a registry defined in [RFC5248].
43394339+43404340+ + Then a single space character.
43414341+43424342+ + Then an implementation-specific information string with a
43434343+ human-readable explanation of the response.
43444344+43454345+ * delivered: "String"
43464346+43474347+ Represents whether the message has been successfully delivered
43484348+ to the recipient. This MUST be one of the following values:
43494349+43504350+ + "queued": The message is in a local mail queue and the
43514351+ status will change once it exits the local mail queues. The
43524352+ "smtpReply" property may still change.
43534353+43544354+ + "yes": The message was successfully delivered to the mail
43554355+ store of the recipient. The "smtpReply" property is final.
43564356+43574357+ + "no": Delivery to the recipient permanently failed. The
43584358+ "smtpReply" property is final.
43594359+43604360+ + "unknown": The final delivery status is unknown, (e.g., it
43614361+ was relayed to an external machine and no further
43624362+ information is available). The "smtpReply" property may
43634363+ still change if a DSN arrives.
43644364+43654365+43664366+43674367+43684368+43694369+43704370+Jenkins & Newman Standards Track [Page 78]
43714371+43724372+RFC 8621 JMAP Mail August 2019
43734373+43744374+43754375+ Note that successful relaying to an external SMTP server SHOULD
43764376+ NOT be taken as an indication that the message has successfully
43774377+ reached the final mail store. In this case though, the server
43784378+ may receive a DSN response, if requested.
43794379+43804380+ If a DSN is received for the recipient with Action equal to
43814381+ "delivered", as per [RFC3464], Section 2.3.3, then the
43824382+ "delivered" property SHOULD be set to "yes"; if the Action
43834383+ equals "failed", the property SHOULD be set to "no". Receipt
43844384+ of any other DSN SHOULD NOT affect this property.
43854385+43864386+ The server MAY also set this property based on other feedback
43874387+ channels.
43884388+43894389+ * displayed: "String"
43904390+43914391+ Represents whether the message has been displayed to the
43924392+ recipient. This MUST be one of the following values:
43934393+43944394+ + "unknown": The display status is unknown. This is the
43954395+ initial value.
43964396+43974397+ + "yes": The recipient's system claims the message content has
43984398+ been displayed to the recipient. Note that there is no
43994399+ guarantee that the recipient has noticed, read, or
44004400+ understood the content.
44014401+44024402+ If a Message Disposition Notification (MDN) is received for
44034403+ this recipient with Disposition-Type (as per [RFC8098],
44044404+ Section 3.2.6.2) equal to "displayed", this property SHOULD be
44054405+ set to "yes".
44064406+44074407+ The server MAY also set this property based on other feedback
44084408+ channels.
44094409+44104410+ o dsnBlobIds: "Id[]" (server-set)
44114411+44124412+ A list of blob ids for DSNs [RFC3464] received for this
44134413+ submission, in order of receipt, oldest first. The blob is the
44144414+ whole MIME message (with a top-level content-type of "multipart/
44154415+ report"), as received.
44164416+44174417+ o mdnBlobIds: "Id[]" (server-set)
44184418+44194419+ A list of blob ids for MDNs [RFC8098] received for this
44204420+ submission, in order of receipt, oldest first. The blob is the
44214421+ whole MIME message (with a top-level content-type of "multipart/
44224422+ report"), as received.
44234423+44244424+44254425+44264426+Jenkins & Newman Standards Track [Page 79]
44274427+44284428+RFC 8621 JMAP Mail August 2019
44294429+44304430+44314431+ JMAP servers MAY choose not to expose DSN and MDN responses as Email
44324432+ objects if they correlate to an EmailSubmission object. It SHOULD
44334433+ only do this if it exposes them in the "dsnBlobIds" and "mdnblobIds"
44344434+ fields instead, and it expects the user to be using clients capable
44354435+ of fetching and displaying delivery status via the EmailSubmission
44364436+ object.
44374437+44384438+ For efficiency, a server MAY destroy EmailSubmission objects at any
44394439+ time after the message is successfully sent or after it has finished
44404440+ retrying to send the message. For very basic SMTP proxies, this MAY
44414441+ be immediately after creation, as it has no way to assign a real id
44424442+ and return the information again if fetched later.
44434443+44444444+ The following JMAP methods are supported.
44454445+44464446+7.1. EmailSubmission/get
44474447+44484448+ This is a standard "/get" method as described in [RFC8620],
44494449+ Section 5.1.
44504450+44514451+7.2. EmailSubmission/changes
44524452+44534453+ This is a standard "/changes" method as described in [RFC8620],
44544454+ Section 5.2.
44554455+44564456+7.3. EmailSubmission/query
44574457+44584458+ This is a standard "/query" method as described in [RFC8620],
44594459+ Section 5.5.
44604460+44614461+ A *FilterCondition* object has the following properties, any of which
44624462+ may be omitted:
44634463+44644464+ o identityIds: "Id[]"
44654465+44664466+ The EmailSubmission "identityId" property must be in this list to
44674467+ match the condition.
44684468+44694469+ o emailIds: "Id[]"
44704470+44714471+ The EmailSubmission "emailId" property must be in this list to
44724472+ match the condition.
44734473+44744474+ o threadIds: "Id[]"
44754475+44764476+ The EmailSubmission "threadId" property must be in this list to
44774477+ match the condition.
44784478+44794479+44804480+44814481+44824482+Jenkins & Newman Standards Track [Page 80]
44834483+44844484+RFC 8621 JMAP Mail August 2019
44854485+44864486+44874487+ o undoStatus: "String"
44884488+44894489+ The EmailSubmission "undoStatus" property must be identical to the
44904490+ value given to match the condition.
44914491+44924492+ o before: "UTCDate"
44934493+44944494+ The "sendAt" property of the EmailSubmission object must be before
44954495+ this date-time to match the condition.
44964496+44974497+ o after: "UTCDate"
44984498+44994499+ The "sendAt" property of the EmailSubmission object must be the
45004500+ same as or after this date-time to match the condition.
45014501+45024502+ An EmailSubmission object matches the FilterCondition if and only if
45034503+ all of the given conditions match. If zero properties are specified,
45044504+ it is automatically true for all objects.
45054505+45064506+ The following EmailSubmission properties MUST be supported for
45074507+ sorting:
45084508+45094509+ o "emailId"
45104510+45114511+ o "threadId"
45124512+45134513+ o "sentAt"
45144514+45154515+7.4. EmailSubmission/queryChanges
45164516+45174517+ This is a standard "/queryChanges" method as described in [RFC8620],
45184518+ Section 5.6.
45194519+45204520+7.5. EmailSubmission/set
45214521+45224522+ This is a standard "/set" method as described in [RFC8620],
45234523+ Section 5.3 with the following two additional request arguments:
45244524+45254525+ o onSuccessUpdateEmail: "Id[PatchObject]|null"
45264526+45274527+ A map of EmailSubmission id to an object containing properties to
45284528+ update on the Email object referenced by the EmailSubmission if
45294529+ the create/update/destroy succeeds. (For references to
45304530+ EmailSubmissions created in the same "/set" invocation, this is
45314531+ equivalent to a creation-reference, so the id will be the creation
45324532+ id prefixed with a "#".)
45334533+45344534+45354535+45364536+45374537+45384538+Jenkins & Newman Standards Track [Page 81]
45394539+45404540+RFC 8621 JMAP Mail August 2019
45414541+45424542+45434543+ o onSuccessDestroyEmail: "Id[]|null"
45444544+45454545+ A list of EmailSubmission ids for which the Email with the
45464546+ corresponding "emailId" should be destroyed if the create/update/
45474547+ destroy succeeds. (For references to EmailSubmission creations,
45484548+ this is equivalent to a creation-reference, so the id will be the
45494549+ creation id prefixed with a "#".)
45504550+45514551+ After all create/update/destroy items in the "EmailSubmission/set"
45524552+ invocation have been processed, a single implicit "Email/set" call
45534553+ MUST be made to perform any changes requested in these two arguments.
45544554+ The response to this MUST be returned after the "EmailSubmission/set"
45554555+ response.
45564556+45574557+ An Email is sent by creating an EmailSubmission object. When
45584558+ processing each create, the server must check that the message is
45594559+ valid, and the user has sufficient authorisation to send it. If the
45604560+ creation succeeds, the message will be sent to the recipients given
45614561+ in the envelope "rcptTo" parameter. The server MUST remove any Bcc
45624562+ header field present on the message during delivery. The server MAY
45634563+ add or remove other header fields from the submitted message or make
45644564+ further alterations in accordance with the server's policy during
45654565+ delivery.
45664566+45674567+ If the referenced Email is destroyed at any point after the
45684568+ EmailSubmission object is created, this MUST NOT change the behaviour
45694569+ of the submission (i.e., it does not cancel a future send). The
45704570+ "emailId" and "threadId" properties of the EmailSubmission object
45714571+ remain, but trying to fetch them (with a standard "Email/get" call)
45724572+ will return a "notFound" error if the corresponding objects have been
45734573+ destroyed.
45744574+45754575+ Similarly, destroying an EmailSubmission object MUST NOT affect the
45764576+ deliveries it represents. It purely removes the record of the
45774577+ submission. The server MAY automatically destroy EmailSubmission
45784578+ objects after some time or in response to other triggers, and MAY
45794579+ forbid the client from manually destroying EmailSubmission objects.
45804580+45814581+ If the message to be sent is larger than the server supports sending,
45824582+ a standard "tooLarge" SetError MUST be returned. A "maxSize"
45834583+ "UnsignedInt" property MUST be present on the SetError specifying the
45844584+ maximum size of a message that may be sent, in octets.
45854585+45864586+ If the Email or Identity id given cannot be found, the submission
45874587+ creation is rejected with a standard "invalidProperties" SetError.
45884588+45894589+45904590+45914591+45924592+45934593+45944594+Jenkins & Newman Standards Track [Page 82]
45954595+45964596+RFC 8621 JMAP Mail August 2019
45974597+45984598+45994599+ The following extra SetError types are defined:
46004600+46014601+ For "create":
46024602+46034603+ o "invalidEmail" - The Email to be sent is invalid in some way. The
46044604+ SetError SHOULD contain a property called "properties" of type
46054605+ "String[]" that lists *all* the properties of the Email that were
46064606+ invalid.
46074607+46084608+ o "tooManyRecipients" - The envelope (supplied or generated) has
46094609+ more recipients than the server allows. A "maxRecipients"
46104610+ "UnsignedInt" property MUST also be present on the SetError
46114611+ specifying the maximum number of allowed recipients.
46124612+46134613+ o "noRecipients" - The envelope (supplied or generated) does not
46144614+ have any rcptTo email addresses.
46154615+46164616+ o "invalidRecipients" - The "rcptTo" property of the envelope
46174617+ (supplied or generated) contains at least one rcptTo value, which
46184618+ is not a valid email address for sending to. An
46194619+ "invalidRecipients" "String[]" property MUST also be present on
46204620+ the SetError, which is a list of the invalid addresses.
46214621+46224622+ o "forbiddenMailFrom" - The server does not permit the user to send
46234623+ a message with the envelope From address [RFC5321].
46244624+46254625+ o "forbiddenFrom" - The server does not permit the user to send a
46264626+ message with the From header field [RFC5322] of the message to be
46274627+ sent.
46284628+46294629+ o "forbiddenToSend" - The user does not have permission to send at
46304630+ all right now for some reason. A "description" "String" property
46314631+ MAY be present on the SetError object to display to the user why
46324632+ they are not permitted.
46334633+46344634+ For "update":
46354635+46364636+ o "cannotUnsend" - The client attempted to update the "undoStatus"
46374637+ of a valid EmailSubmission object from "pending" to "canceled",
46384638+ but the message cannot be unsent.
46394639+46404640+46414641+46424642+46434643+46444644+46454645+46464646+46474647+46484648+46494649+46504650+Jenkins & Newman Standards Track [Page 83]
46514651+46524652+RFC 8621 JMAP Mail August 2019
46534653+46544654+46554655+7.5.1. Example
46564656+46574657+ The following example presumes a draft of the Email to be sent has
46584658+ already been saved, and its Email id is "M7f6ed5bcfd7e2604d1753f6c".
46594659+ This call then sends the Email immediately, and if successful,
46604660+ removes the "$draft" flag and moves it from the drafts folder (which
46614661+ has Mailbox id "7cb4e8ee-df87-4757-b9c4-2ea1ca41b38e") to the sent
46624662+ folder (which we presume has Mailbox id "73dbcb4b-bffc-48bd-8c2a-
46634663+ a2e91ca672f6").
46644664+46654665+ [[ "EmailSubmission/set", {
46664666+ "accountId": "ue411d190",
46674667+ "create": {
46684668+ "k1490": {
46694669+ "identityId": "I64588216",
46704670+ "emailId": "M7f6ed5bcfd7e2604d1753f6c",
46714671+ "envelope": {
46724672+ "mailFrom": {
46734673+ "email": "john@example.com",
46744674+ "parameters": null
46754675+ },
46764676+ "rcptTo": [{
46774677+ "email": "jane@example.com",
46784678+ "parameters": null
46794679+ },
46804680+ ...
46814681+ ]
46824682+ }
46834683+ }
46844684+ },
46854685+ "onSuccessUpdateEmail": {
46864686+ "#k1490": {
46874687+ "mailboxIds/7cb4e8ee-df87-4757-b9c4-2ea1ca41b38e": null,
46884688+ "mailboxIds/73dbcb4b-bffc-48bd-8c2a-a2e91ca672f6": true,
46894689+ "keywords/$draft": null
46904690+ }
46914691+ }
46924692+ }, "0" ]]
46934693+46944694+46954695+46964696+46974697+46984698+46994699+47004700+47014701+47024702+47034703+47044704+47054705+47064706+Jenkins & Newman Standards Track [Page 84]
47074707+47084708+RFC 8621 JMAP Mail August 2019
47094709+47104710+47114711+ A successful response might look like this. Note that there are two
47124712+ responses due to the implicit "Email/set" call, but both have the
47134713+ same method call id as they are due to the same call in the request:
47144714+47154715+ [[ "EmailSubmission/set", {
47164716+ "accountId": "ue411d190",
47174717+ "oldState": "012421s6-8nrq-4ps4-n0p4-9330r951ns21",
47184718+ "newState": "355421f6-8aed-4cf4-a0c4-7377e951af36",
47194719+ "created": {
47204720+ "k1490": {
47214721+ "id": "ES-3bab7f9a-623e-4acf-99a5-2e67facb02a0"
47224722+ }
47234723+ }
47244724+ }, "0" ],
47254725+ [ "Email/set", {
47264726+ "accountId": "ue411d190",
47274727+ "oldState": "778193",
47284728+ "newState": "778197",
47294729+ "updated": {
47304730+ "M7f6ed5bcfd7e2604d1753f6c": null
47314731+ }
47324732+ }, "0" ]]
47334733+47344734+ Suppose instead an admin has removed sending rights for the user, so
47354735+ the submission is rejected with a "forbiddenToSend" error. The
47364736+ description argument of the error is intended for display to the
47374737+ user, so it should be localised appropriately. Let's suppose the
47384738+ request was sent with an Accept-Language header like this:
47394739+47404740+ Accept-Language: de;q=0.9,en;q=0.8
47414741+47424742+47434743+47444744+47454745+47464746+47474747+47484748+47494749+47504750+47514751+47524752+47534753+47544754+47554755+47564756+47574757+47584758+47594759+47604760+47614761+47624762+Jenkins & Newman Standards Track [Page 85]
47634763+47644764+RFC 8621 JMAP Mail August 2019
47654765+47664766+47674767+ The server should attempt to choose the best localisation from those
47684768+ it has available based on the Accept-Language header, as described in
47694769+ [RFC8620], Section 3.8. If the server has English, French, and
47704770+ German translations, it would choose German as the preferred language
47714771+ and return a response like this:
47724772+47734773+[[ "EmailSubmission/set", {
47744774+ "accountId": "ue411d190",
47754775+ "oldState": "012421s6-8nrq-4ps4-n0p4-9330r951ns21",
47764776+ "newState": "012421s6-8nrq-4ps4-n0p4-9330r951ns21",
47774777+ "notCreated": {
47784778+ "k1490": {
47794779+ "type": "forbiddenToSend",
47804780+ "description": "Verzeihung, wegen verdaechtiger Aktivitaeten Ihres
47814781+ Benutzerkontos haben wir den Versand von Nachrichten gesperrt.
47824782+ Bitte wenden Sie sich fuer Hilfe an unser Support Team."
47834783+ }
47844784+ }
47854785+}, "0" ]]
47864786+47874787+8. Vacation Response
47884788+47894789+ A vacation response sends an automatic reply when a message is
47904790+ delivered to the mail store, informing the original sender that their
47914791+ message may not be read for some time.
47924792+47934793+ Automated message sending can produce undesirable behaviour. To
47944794+ avoid this, implementors MUST follow the recommendations set forth in
47954795+ [RFC3834].
47964796+47974797+ The *VacationResponse* object represents the state of vacation-
47984798+ response-related settings for an account. It has the following
47994799+ properties:
48004800+48014801+ o id: "Id" (immutable; server-set)
48024802+48034803+ The id of the object. There is only ever one VacationResponse
48044804+ object, and its id is "singleton".
48054805+48064806+ o isEnabled: "Boolean"
48074807+48084808+ Should a vacation response be sent if a message arrives between
48094809+ the "fromDate" and "toDate"?
48104810+48114811+48124812+48134813+48144814+48154815+48164816+48174817+48184818+Jenkins & Newman Standards Track [Page 86]
48194819+48204820+RFC 8621 JMAP Mail August 2019
48214821+48224822+48234823+ o fromDate: "UTCDate|null"
48244824+48254825+ If "isEnabled" is true, messages that arrive on or after this
48264826+ date-time (but before the "toDate" if defined) should receive the
48274827+ user's vacation response. If null, the vacation response is
48284828+ effective immediately.
48294829+48304830+ o toDate: "UTCDate|null"
48314831+48324832+ If "isEnabled" is true, messages that arrive before this date-time
48334833+ (but on or after the "fromDate" if defined) should receive the
48344834+ user's vacation response. If null, the vacation response is
48354835+ effective indefinitely.
48364836+48374837+ o subject: "String|null"
48384838+48394839+ The subject that will be used by the message sent in response to
48404840+ messages when the vacation response is enabled. If null, an
48414841+ appropriate subject SHOULD be set by the server.
48424842+48434843+ o textBody: "String|null"
48444844+48454845+ The plaintext body to send in response to messages when the
48464846+ vacation response is enabled. If this is null, the server SHOULD
48474847+ generate a plaintext body part from the "htmlBody" when sending
48484848+ vacation responses but MAY choose to send the response as HTML
48494849+ only. If both "textBody" and "htmlBody" are null, an appropriate
48504850+ default body SHOULD be generated for responses by the server.
48514851+48524852+ o htmlBody: "String|null"
48534853+48544854+ The HTML body to send in response to messages when the vacation
48554855+ response is enabled. If this is null, the server MAY choose to
48564856+ generate an HTML body part from the "textBody" when sending
48574857+ vacation responses or MAY choose to send the response as plaintext
48584858+ only.
48594859+48604860+ The following JMAP methods are supported.
48614861+48624862+8.1. VacationResponse/get
48634863+48644864+ This is a standard "/get" method as described in [RFC8620],
48654865+ Section 5.1.
48664866+48674867+ There MUST only be exactly one VacationResponse object in an account.
48684868+ It MUST have the id "singleton".
48694869+48704870+48714871+48724872+48734873+48744874+Jenkins & Newman Standards Track [Page 87]
48754875+48764876+RFC 8621 JMAP Mail August 2019
48774877+48784878+48794879+8.2. VacationResponse/set
48804880+48814881+ This is a standard "/set" method as described in [RFC8620],
48824882+ Section 5.3.
48834883+48844884+9. Security Considerations
48854885+48864886+ All security considerations of JMAP [RFC8620] apply to this
48874887+ specification. Additional considerations specific to the data types
48884888+ and functionality introduced by this document are described in the
48894889+ following subsections.
48904890+48914891+9.1. EmailBodyPart Value
48924892+48934893+ Service providers typically perform security filtering on incoming
48944894+ messages, and it's important that the detection of content-type and
48954895+ charset for the security filter aligns with the heuristics performed
48964896+ by JMAP servers. Servers that apply heuristics to determine the
48974897+ content-type or charset for an EmailBodyValue SHOULD document the
48984898+ heuristics and provide a mechanism to turn them off in the event they
48994899+ are misaligned with the security filter used at a particular mail
49004900+ host.
49014901+49024902+ Automatic conversion of charsets that allow hidden channels for ASCII
49034903+ text, such as UTF-7, have been problematic for security filters in
49044904+ the past, so server implementations can mitigate this risk by having
49054905+ such conversions off-by-default and/or separately configurable.
49064906+49074907+ To allow the client to restrict the volume of data it can receive in
49084908+ response to a request, a maximum length may be requested for the data
49094909+ returned for a textual body part. However, truncating the data may
49104910+ change the semantic meaning, for example, truncating a URL changes
49114911+ its location. Servers that scan for links to malicious sites should
49124912+ take care to either ensure truncation is not at a semantically
49134913+ significant point or rescan the truncated value for malicious content
49144914+ before returning it.
49154915+49164916+9.2. HTML Email Display
49174917+49184918+ HTML message bodies provide richer formatting for messages but
49194919+ present a number of security challenges, especially when embedded in
49204920+ a webmail context in combination with interface HTML. Clients that
49214921+ render HTML messages should carefully consider the potential risks,
49224922+ including:
49234923+49244924+49254925+49264926+49274927+49284928+49294929+49304930+Jenkins & Newman Standards Track [Page 88]
49314931+49324932+RFC 8621 JMAP Mail August 2019
49334933+49344934+49354935+ o Embedded JavaScript can rewrite the message to change its content
49364936+ on subsequent opening, allowing users to be mislead. In webmail
49374937+ systems, if run in the same origin as the interface, it can access
49384938+ and exfiltrate all private data accessible to the user, including
49394939+ all other messages and potentially contacts, calendar events,
49404940+ settings, and credentials. It can also rewrite the interface to
49414941+ undetectably phish passwords. A compromise is likely to be
49424942+ persistent, not just for the duration of page load, due to
49434943+ exfiltration of session credentials or installation of a service
49444944+ worker that can intercept all subsequent network requests
49454945+ (however, this would only be possible if blob downloads are also
49464946+ available on the same origin, and the service worker script is
49474947+ attached to the message).
49484948+49494949+ o HTML documents may load content directly from the Internet rather
49504950+ than just referencing attached resources. For example, you may
49514951+ have an "<img>" tag with an external "src" attribute. This may
49524952+ leak to the sender when a message is opened, as well as the IP
49534953+ address of the recipient. Cookies may also be sent and set by the
49544954+ server, allowing tracking between different messages and even
49554955+ website visits and advertising profiles.
49564956+49574957+ o In webmail systems, CSS can break the layout or create phishing
49584958+ vulnerabilities. For example, the use of "position:fixed" can
49594959+ allow a message to draw content outside of its normal bounds,
49604960+ potentially clickjacking a real interface element.
49614961+49624962+ o If in a webmail context and not inside a separate frame, any
49634963+ styles defined in CSS rules will apply to interface elements as
49644964+ well if the selector matches, allowing the interface to be
49654965+ modified. Similarly, any interface styles that match elements in
49664966+ the message will alter their appearance, potentially breaking the
49674967+ layout of the message.
49684968+49694969+ o The link text in HTML has no necessary correlation with the actual
49704970+ target of the link, which can be used to make phishing attacks
49714971+ more convincing.
49724972+49734973+ o Links opened from a message or embedded external content may leak
49744974+ private info in the Referer header sent by default in most
49754975+ systems.
49764976+49774977+ o Forms can be used to mimic login boxes, providing a potent
49784978+ phishing vector if allowed to submit directly from the message
49794979+ display.
49804980+49814981+49824982+49834983+49844984+49854985+49864986+Jenkins & Newman Standards Track [Page 89]
49874987+49884988+RFC 8621 JMAP Mail August 2019
49894989+49904990+49914991+ There are a number of ways clients can mitigate these issues, and a
49924992+ defence-in-depth approach that uses a combination of techniques will
49934993+ provide the strongest security.
49944994+49954995+ o HTML can be filtered before rendering, stripping potentially
49964996+ malicious content. Sanitising HTML correctly is tricky, and
49974997+ implementors are strongly recommended to use a well-tested library
49984998+ with a carefully vetted whitelist-only approach. New features
49994999+ with unexpected security characteristics may be added to HTML
50005000+ rendering engines in the future; a blacklist approach is likely to
50015001+ result in security issues.
50025002+50035003+ Subtle differences in parsing of HTML can introduce security
50045004+ flaws: to filter with 100% accuracy, you need to use the same
50055005+ parser that the HTML rendering engine will use.
50065006+50075007+ o Encapsulating the message in an "<iframe sandbox>", as defined in
50085008+ [HTML], Section 4.7.6, can help mitigate a number of risks. This
50095009+ will:
50105010+50115011+ * Disable JavaScript.
50125012+50135013+ * Disable form submission.
50145014+50155015+ * Prevent drawing outside of its bounds or conflicts between
50165016+ message CSS and interface CSS.
50175017+50185018+ * Establish a unique anonymous origin, separate to the containing
50195019+ origin.
50205020+50215021+ o A strong Content Security Policy (see <https://www.w3.org/TR/
50225022+ CSP3/>) can, among other things, block JavaScript and the loading
50235023+ of external content should it manage to evade the filter.
50245024+50255025+ o The leakage of information in the Referer header can be mitigated
50265026+ with the use of a referrer policy (see <https://www.w3.org/TR/
50275027+ referrer-policy/>).
50285028+50295029+ o A "crossorigin=anonymous" attribute on tags that load remote
50305030+ content can prevent cookies from being sent.
50315031+50325032+ o If adding "target=_blank" to open links in new tabs, also add
50335033+ "rel=noopener" to ensure the page that opens cannot change the URL
50345034+ in the original tab to redirect the user to a phishing site.
50355035+50365036+ As highly complex software components, HTML rendering engines
50375037+ increase the attack surface of a client considerably, especially when
50385038+ being used to process untrusted, potentially malicious content.
50395039+50405040+50415041+50425042+Jenkins & Newman Standards Track [Page 90]
50435043+50445044+RFC 8621 JMAP Mail August 2019
50455045+50465046+50475047+ Serious bugs have been found in image decoders, JavaScript engines,
50485048+ and HTML parsers in the past, which could lead to full system
50495049+ compromise. Clients using an engine should ensure they get the
50505050+ latest version and continue to incorporate any security patches
50515051+ released by the vendor.
50525052+50535053+9.3. Multiple Part Display
50545054+50555055+ Messages may consist of multiple parts to be displayed sequentially
50565056+ as a body. Clients MUST render each part in isolation and MUST NOT
50575057+ concatenate the raw text values to render. Doing so may change the
50585058+ overall semantics of the message. If the client or server is
50595059+ decrypting a Pretty Good Privacy (PGP) or S/MIME encrypted part,
50605060+ concatenating with other parts may leak the decrypted text to an
50615061+ attacker, as described in [EFAIL].
50625062+50635063+9.4. Email Submission
50645064+50655065+ SMTP submission servers [RFC6409] use a number of mechanisms to
50665066+ mitigate damage caused by compromised user accounts and end-user
50675067+ systems including rate limiting, anti-virus/anti-spam milters (mail
50685068+ filters), and other technologies. The technologies work better when
50695069+ they have more information about the client connection. If JMAP
50705070+ email submission is implemented as a proxy to an SMTP submission
50715071+ server, it is useful to communicate this information from the JMAP
50725072+ proxy to the submission server. The de facto XCLIENT extension to
50735073+ SMTP [XCLIENT] can be used to do this, but use of an authenticated
50745074+ channel is recommended to limit use of that extension to explicitly
50755075+ authorised proxies.
50765076+50775077+ JMAP servers that proxy to an SMTP submission server SHOULD allow use
50785078+ of the submissions port [RFC8314]. Implementation of a mechanism
50795079+ similar to SMTP XCLIENT is strongly encouraged. While Simple
50805080+ Authentication and Security Layer (SASL) PLAIN over TLS [RFC4616] is
50815081+ presently the mandatory-to-implement mechanism for interoperability
50825082+ with SMTP submission servers [RFC4954], a JMAP submission proxy
50835083+ SHOULD implement and prefer a stronger mechanism for this use case
50845084+ such as TLS client certificate authentication with SASL EXTERNAL
50855085+ ([RFC4422], Appendix A) or Salted Challenge Response Authentication
50865086+ Mechanism (SCRAM) [RFC7677].
50875087+50885088+ In the event the JMAP server directly relays mail to SMTP servers in
50895089+ other administrative domains, implementation of the de facto [milter]
50905090+ protocol is strongly encouraged to integrate with third-party
50915091+ products that address security issues including anti-virus/anti-spam,
50925092+ reputation protection, compliance archiving, and data loss
50935093+ prevention. Proxying to a local SMTP submission server may be a
50945094+ simpler way to provide such security services.
50955095+50965096+50975097+50985098+Jenkins & Newman Standards Track [Page 91]
50995099+51005100+RFC 8621 JMAP Mail August 2019
51015101+51025102+51035103+9.5. Partial Account Access
51045104+51055105+ A user may only have permission to access a subset of the data that
51065106+ exists in an account. To avoid leaking unauthorised information, in
51075107+ such a situation, the server MUST treat any data the user does not
51085108+ have permission to access the same as if it did not exist.
51095109+51105110+ For example, suppose user A has an account with two Mailboxes, inbox
51115111+ and sent, but only shares the inbox with user B. In this case, when
51125112+ user B fetches Mailboxes for this account, the server MUST behave as
51135113+ though the sent Mailbox did not exist. Similarly, when querying or
51145114+ fetching Email objects, it MUST treat any messages that just belong
51155115+ to the sent Mailbox as though they did not exist. Fetching Thread
51165116+ objects MUST only return ids for Email objects the user has
51175117+ permission to access; if none, the Thread again MUST be treated the
51185118+ same as if it did not exist.
51195119+51205120+ If the server forbids a single account from having two identical
51215121+ messages, or two messages with the same Message-Id header field, a
51225122+ user with write access can use the error returned by trying to
51235123+ create/import such a message to detect whether it already exists in
51245124+ an inaccessible portion of the account.
51255125+51265126+9.6. Permission to Send from an Address
51275127+51285128+ In recent years, the email ecosystem has moved towards associating
51295129+ trust with the From address in the message [RFC5322], particularly
51305130+ with schemes such as Domain-based Message Authentication, Reporting,
51315131+ and Conformance (DMARC) [RFC7489].
51325132+51335133+ The set of Identity objects (see Section 6) in an account lets the
51345134+ client know which email addresses the user has permission to send
51355135+ from. Each email submission is associated with an Identity, and
51365136+ servers SHOULD reject submissions where the From header field of the
51375137+ message does not correspond to the associated Identity.
51385138+51395139+ The server MAY allow an exception to send an exact copy of an
51405140+ existing message received into the mail store to another address
51415141+ (otherwise known as "redirecting" or "bouncing"), although it is
51425142+ RECOMMENDED the server limit this to destinations the user has
51435143+ verified they also control.
51445144+51455145+ If the user attempts to create a new Identity object, the server MUST
51465146+ reject it with the appropriate error if the user does not have
51475147+ permission to use that email address to send from.
51485148+51495149+51505150+51515151+51525152+51535153+51545154+Jenkins & Newman Standards Track [Page 92]
51555155+51565156+RFC 8621 JMAP Mail August 2019
51575157+51585158+51595159+ The SMTP MAIL FROM address [RFC5321] is often confused with the From
51605160+ message header field [RFC5322]. The user generally only ever sees
51615161+ the address in the message header field, and this is the primary one
51625162+ to enforce. However, the server MUST also enforce appropriate
51635163+ restrictions on the MAIL FROM address [RFC5321] to stop the user from
51645164+ flooding a third-party address with bounces and non-delivery notices.
51655165+51665166+ The JMAP submission model provides separate errors for impermissible
51675167+ addresses in either context.
51685168+51695169+10. IANA Considerations
51705170+51715171+10.1. JMAP Capability Registration for "mail"
51725172+51735173+ IANA has registered the "mail" JMAP Capability as follows:
51745174+51755175+ Capability Name: urn:ietf:params:jmap:mail
51765176+51775177+ Specification document: this document
51785178+51795179+ Intended use: common
51805180+51815181+ Change Controller: IETF
51825182+51835183+ Security and privacy considerations: this document, Section 9
51845184+51855185+10.2. JMAP Capability Registration for "submission"
51865186+51875187+ IANA has registered the "submission" JMAP Capability as follows:
51885188+51895189+ Capability Name: urn:ietf:params:jmap:submission
51905190+51915191+ Specification document: this document
51925192+51935193+ Intended use: common
51945194+51955195+ Change Controller: IETF
51965196+51975197+ Security and privacy considerations: this document, Section 9
51985198+51995199+52005200+52015201+52025202+52035203+52045204+52055205+52065206+52075207+52085208+52095209+52105210+Jenkins & Newman Standards Track [Page 93]
52115211+52125212+RFC 8621 JMAP Mail August 2019
52135213+52145214+52155215+10.3. JMAP Capability Registration for "vacationresponse"
52165216+52175217+ IANA has registered the "vacationresponse" JMAP Capability as
52185218+ follows:
52195219+52205220+ Capability Name: urn:ietf:params:jmap:vacationresponse
52215221+52225222+ Specification document: this document
52235223+52245224+ Intended use: common
52255225+52265226+ Change Controller: IETF
52275227+52285228+ Security and privacy considerations: this document, Section 9
52295229+52305230+10.4. IMAP and JMAP Keywords Registry
52315231+52325232+ This document makes two changes to the IMAP keywords registry as
52335233+ defined in [RFC5788].
52345234+52355235+ First, the name of the registry is changed to the "IMAP and JMAP
52365236+ Keywords" registry.
52375237+52385238+ Second, a scope column is added to the template and registry
52395239+ indicating whether a keyword applies to "IMAP-only", "JMAP-only",
52405240+ "both", or "reserved". All keywords already in the IMAP keyword
52415241+ registry have been marked with a scope of "both". The "reserved"
52425242+ status can be used to prevent future registration of a name that
52435243+ would be confusing if registered. Registration of keywords with
52445244+ scope "reserved" omit most fields in the registration template (see
52455245+ registration of "$recent" below for an example); such registrations
52465246+ are intended to be infrequent.
52475247+52485248+ IMAP clients MAY silently ignore any keywords marked "JMAP-only" or
52495249+ "reserved" in the event they appear in protocol. JMAP clients MAY
52505250+ silently ignore any keywords marked "IMAP-only" or "reserved" in the
52515251+ event they appear in protocol.
52525252+52535253+ New "JMAP-only" keywords are registered in the following subsections.
52545254+ These keywords correspond to IMAP system keywords and are thus not
52555255+ appropriate for use in IMAP. These keywords cannot be subsequently
52565256+ registered for use in IMAP except via standards action.
52575257+52585258+52595259+52605260+52615261+52625262+52635263+52645264+52655265+52665266+Jenkins & Newman Standards Track [Page 94]
52675267+52685268+RFC 8621 JMAP Mail August 2019
52695269+52705270+52715271+10.4.1. Registration of JMAP Keyword "$draft"
52725272+52735273+ This registers the "JMAP-only" keyword "$draft" in the "IMAP and JMAP
52745274+ Keywords" registry.
52755275+52765276+ Keyword name: $draft
52775277+52785278+ Scope: JMAP-only
52795279+52805280+ Purpose (description): This is set when the user wants to treat the
52815281+ message as a draft the user is composing. This is the JMAP
52825282+ equivalent of the IMAP \Draft flag.
52835283+52845284+ Private or Shared on a server: BOTH
52855285+52865286+ Is it an advisory keyword or may it cause an automatic action:
52875287+ Automatic. If the account has an IMAP mailbox marked with the
52885288+ \Drafts special use attribute [RFC6154], setting this flag MAY cause
52895289+ the message to appear in that mailbox automatically. Certain JMAP
52905290+ computed values such as "unreadEmails" will change as a result of
52915291+ changing this flag. In addition, mail clients will typically present
52925292+ draft messages in a composer window rather than a viewer window.
52935293+52945294+ When/by whom the keyword is set/cleared: This is typically set by a
52955295+ JMAP client when referring to a draft message. One model for draft
52965296+ Emails would result in clearing this flag in an "EmailSubmission/set"
52975297+ operation with an "onSuccessUpdateEmail" argument. In a mail store
52985298+ shared by JMAP and IMAP, this is also set and cleared as necessary so
52995299+ it matches the IMAP \Draft flag.
53005300+53015301+ Related keywords: None
53025302+53035303+ Related IMAP/JMAP Capabilities: SPECIAL-USE [RFC6154]
53045304+53055305+ Security Considerations: A server implementing this keyword as a
53065306+ shared keyword may disclose that a user considers the message a draft
53075307+ message. This information would be exposed to other users with read
53085308+ permission for the Mailbox keywords.
53095309+53105310+ Published specification: this document
53115311+53125312+ Person & email address to contact for further information:
53135313+ JMAP mailing list <jmap@ietf.org>
53145314+53155315+ Intended usage: COMMON
53165316+53175317+ Owner/Change controller: IESG
53185318+53195319+53205320+53215321+53225322+Jenkins & Newman Standards Track [Page 95]
53235323+53245324+RFC 8621 JMAP Mail August 2019
53255325+53265326+53275327+10.4.2. Registration of JMAP Keyword "$seen"
53285328+53295329+ This registers the "JMAP-only" keyword "$seen" in the "IMAP and JMAP
53305330+ Keywords" registry.
53315331+53325332+ Keyword name: $seen
53335333+53345334+ Scope: JMAP-only
53355335+53365336+ Purpose (description): This is set when the user wants to treat the
53375337+ message as read. This is the JMAP equivalent of the IMAP \Seen flag.
53385338+53395339+ Private or Shared on a server: BOTH
53405340+53415341+ Is it an advisory keyword or may it cause an automatic action:
53425342+ Advisory. However, certain JMAP computed values such as
53435343+ "unreadEmails" will change as a result of changing this flag.
53445344+53455345+ When/by whom the keyword is set/cleared: This is set by a JMAP client
53465346+ when it presents the message content to the user; clients often offer
53475347+ an option to clear this flag. In a mail store shared by JMAP and
53485348+ IMAP, this is also set and cleared as necessary so it matches the
53495349+ IMAP \Seen flag.
53505350+53515351+ Related keywords: None
53525352+53535353+ Related IMAP/JMAP Capabilities: None
53545354+53555355+ Security Considerations: A server implementing this keyword as a
53565356+ shared keyword may disclose that a user considers the message to have
53575357+ been read. This information would be exposed to other users with
53585358+ read permission for the Mailbox keywords.
53595359+53605360+ Published specification: this document
53615361+53625362+ Person & email address to contact for further information:
53635363+ JMAP mailing list <jmap@ietf.org>
53645364+53655365+ Intended usage: COMMON
53665366+53675367+ Owner/Change controller: IESG
53685368+53695369+53705370+53715371+53725372+53735373+53745374+53755375+53765376+53775377+53785378+Jenkins & Newman Standards Track [Page 96]
53795379+53805380+RFC 8621 JMAP Mail August 2019
53815381+53825382+53835383+10.4.3. Registration of JMAP Keyword "$flagged"
53845384+53855385+ This registers the "JMAP-only" keyword "$flagged" in the "IMAP and
53865386+ JMAP Keywords" registry.
53875387+53885388+ Keyword name: $flagged
53895389+53905390+ Scope: JMAP-only
53915391+53925392+ Purpose (description): This is set when the user wants to treat the
53935393+ message as flagged for urgent/special attention. This is the JMAP
53945394+ equivalent of the IMAP \Flagged flag.
53955395+53965396+ Private or Shared on a server: BOTH
53975397+53985398+ Is it an advisory keyword or may it cause an automatic action:
53995399+ Automatic. If the account has an IMAP mailbox marked with the
54005400+ \Flagged special use attribute [RFC6154], setting this flag MAY cause
54015401+ the message to appear in that mailbox automatically.
54025402+54035403+ When/by whom the keyword is set/cleared: JMAP clients typically allow
54045404+ a user to set/clear this flag as desired. In a mail store shared by
54055405+ JMAP and IMAP, this is also set and cleared as necessary so it
54065406+ matches the IMAP \Flagged flag.
54075407+54085408+ Related keywords: None
54095409+54105410+ Related IMAP/JMAP Capabilities: SPECIAL-USE [RFC6154]
54115411+54125412+ Security Considerations: A server implementing this keyword as a
54135413+ shared keyword may disclose that a user considers the message as
54145414+ flagged for urgent/special attention. This information would be
54155415+ exposed to other users with read permission for the Mailbox keywords.
54165416+54175417+ Published specification: this document
54185418+54195419+ Person & email address to contact for further information:
54205420+ JMAP mailing list <jmap@ietf.org>
54215421+54225422+ Intended usage: COMMON
54235423+54245424+ Owner/Change controller: IESG
54255425+54265426+54275427+54285428+54295429+54305430+54315431+54325432+54335433+54345434+Jenkins & Newman Standards Track [Page 97]
54355435+54365436+RFC 8621 JMAP Mail August 2019
54375437+54385438+54395439+10.4.4. Registration of JMAP Keyword "$answered"
54405440+54415441+ This registers the "JMAP-only" keyword "$answered" in the "IMAP and
54425442+ JMAP Keywords" registry.
54435443+54445444+ Keyword name: $answered
54455445+54465446+ Scope: JMAP-only
54475447+54485448+ Purpose (description): This is set when the message has been
54495449+ answered.
54505450+54515451+ Private or Shared on a server: BOTH
54525452+54535453+ Is it an advisory keyword or may it cause an automatic action:
54545454+ Advisory.
54555455+54565456+ When/by whom the keyword is set/cleared: JMAP clients typically set
54575457+ this when submitting a reply or answer to the message. It may be set
54585458+ by the "EmailSubmission/set" operation with an "onSuccessUpdateEmail"
54595459+ argument. In a mail store shared by JMAP and IMAP, this is also set
54605460+ and cleared as necessary so it matches the IMAP \Answered flag.
54615461+54625462+ Related keywords: None
54635463+54645464+ Related IMAP/JMAP Capabilities: None
54655465+54665466+ Security Considerations: A server implementing this keyword as a
54675467+ shared keyword may disclose that a user has replied to a message.
54685468+ This information would be exposed to other users with read permission
54695469+ for the Mailbox keywords.
54705470+54715471+ Published specification: this document
54725472+54735473+ Person & email address to contact for further information:
54745474+ JMAP mailing list <jmap@ietf.org>
54755475+54765476+ Intended usage: COMMON
54775477+54785478+ Owner/Change controller: IESG
54795479+54805480+54815481+54825482+54835483+54845484+54855485+54865486+54875487+54885488+54895489+54905490+Jenkins & Newman Standards Track [Page 98]
54915491+54925492+RFC 8621 JMAP Mail August 2019
54935493+54945494+54955495+10.4.5. Registration of "$recent" Keyword
54965496+54975497+ This registers the keyword "$recent" in the "IMAP and JMAP Keywords"
54985498+ registry.
54995499+55005500+ Keyword name: $recent
55015501+55025502+ Scope: reserved
55035503+55045504+ Purpose (description): This keyword is not used to avoid confusion
55055505+ with the IMAP \Recent system flag.
55065506+55075507+ Published specification: this document
55085508+55095509+ Person & email address to contact for further information:
55105510+ JMAP mailing list <jmap@ietf.org>
55115511+55125512+ Owner/Change controller: IESG
55135513+55145514+10.5. IMAP Mailbox Name Attributes Registry
55155515+55165516+10.5.1. Registration of "inbox" Role
55175517+55185518+ This registers the "JMAP-only" "inbox" attribute in the "IMAP Mailbox
55195519+ Name Attributes" registry, as established in [RFC8457].
55205520+55215521+ Attribute Name: Inbox
55225522+55235523+ Description: New mail is delivered here by default.
55245524+55255525+ Reference: This document, Section 10.5.1
55265526+55275527+ Usage Notes: JMAP only
55285528+55295529+55305530+55315531+55325532+55335533+55345534+55355535+55365536+55375537+55385538+55395539+55405540+55415541+55425542+55435543+55445544+55455545+55465546+Jenkins & Newman Standards Track [Page 99]
55475547+55485548+RFC 8621 JMAP Mail August 2019
55495549+55505550+55515551+10.6. JMAP Error Codes Registry
55525552+55535553+ The following subsections register several new error codes in the
55545554+ "JMAP Error Codes" registry, as defined in [RFC8620].
55555555+55565556+10.6.1. mailboxHasChild
55575557+55585558+ JMAP Error Code: mailboxHasChild
55595559+55605560+ Intended use: common
55615561+55625562+ Change controller: IETF
55635563+55645564+ Reference: This document, Section 2.5
55655565+55665566+ Description: The Mailbox still has at least one child Mailbox. The
55675567+ client MUST remove these before it can delete the parent Mailbox.
55685568+55695569+10.6.2. mailboxHasEmail
55705570+55715571+ JMAP Error Code: mailboxHasEmail
55725572+55735573+ Intended use: common
55745574+55755575+ Change controller: IETF
55765576+55775577+ Reference: This document, Section 2.5
55785578+55795579+ Description: The Mailbox has at least one message assigned to it, and
55805580+ the onDestroyRemoveEmails argument was false.
55815581+55825582+10.6.3. blobNotFound
55835583+55845584+ JMAP Error Code: blobNotFound
55855585+55865586+ Intended use: common
55875587+55885588+ Change controller: IETF
55895589+55905590+ Reference: This document, Section 4.6
55915591+55925592+ Description: At least one blob id referenced in the object doesn't
55935593+ exist.
55945594+55955595+55965596+55975597+55985598+55995599+56005600+56015601+56025602+Jenkins & Newman Standards Track [Page 100]
56035603+56045604+RFC 8621 JMAP Mail August 2019
56055605+56065606+56075607+10.6.4. tooManyKeywords
56085608+56095609+ JMAP Error Code: tooManyKeywords
56105610+56115611+ Intended use: common
56125612+56135613+ Change controller: IETF
56145614+56155615+ Reference: This document, Section 4.6
56165616+56175617+ Description: The change to the Email's keywords would exceed a
56185618+ server-defined maximum.
56195619+56205620+10.6.5. tooManyMailboxes
56215621+56225622+ JMAP Error Code: tooManyMailboxes
56235623+56245624+ Intended use: common
56255625+56265626+ Change controller: IETF
56275627+56285628+ Reference: This document, Section 4.6
56295629+56305630+ Description: The change to the set of Mailboxes that this Email is in
56315631+ would exceed a server-defined maximum.
56325632+56335633+10.6.6. invalidEmail
56345634+56355635+ JMAP Error Code: invalidEmail
56365636+56375637+ Intended use: common
56385638+56395639+ Change controller: IETF
56405640+56415641+ Reference: This document, Section 7.5
56425642+56435643+ Description: The Email to be sent is invalid in some way.
56445644+56455645+56465646+56475647+56485648+56495649+56505650+56515651+56525652+56535653+56545654+56555655+56565656+56575657+56585658+Jenkins & Newman Standards Track [Page 101]
56595659+56605660+RFC 8621 JMAP Mail August 2019
56615661+56625662+56635663+10.6.7. tooManyRecipients
56645664+56655665+ JMAP Error Code: tooManyRecipients
56665666+56675667+ Intended use: common
56685668+56695669+ Change controller: IETF
56705670+56715671+ Reference: This document, Section 7.5
56725672+56735673+ Description: The envelope [RFC5321] (supplied or generated) has more
56745674+ recipients than the server allows.
56755675+56765676+10.6.8. noRecipients
56775677+56785678+ JMAP Error Code: noRecipients
56795679+56805680+ Intended use: common
56815681+56825682+ Change controller: IETF
56835683+56845684+ Reference: This document, Section 7.5
56855685+56865686+ Description: The envelope [RFC5321] (supplied or generated) does not
56875687+ have any rcptTo email addresses.
56885688+56895689+10.6.9. invalidRecipients
56905690+56915691+ JMAP Error Code: invalidRecipients
56925692+56935693+ Intended use: common
56945694+56955695+ Change controller: IETF
56965696+56975697+ Reference: This document, Section 7.5
56985698+56995699+ Description: The rcptTo property of the envelope [RFC5321] (supplied
57005700+ or generated) contains at least one rcptTo value that is not a valid
57015701+ email address for sending to.
57025702+57035703+57045704+57055705+57065706+57075707+57085708+57095709+57105710+57115711+57125712+57135713+57145714+Jenkins & Newman Standards Track [Page 102]
57155715+57165716+RFC 8621 JMAP Mail August 2019
57175717+57185718+57195719+10.6.10. forbiddenMailFrom
57205720+57215721+ JMAP Error Code: forbiddenMailFrom
57225722+57235723+ Intended use: common
57245724+57255725+ Change controller: IETF
57265726+57275727+ Reference: This document, Section 7.5
57285728+57295729+ Description: The server does not permit the user to send a message
57305730+ with this envelope From address [RFC5321].
57315731+57325732+10.6.11. forbiddenFrom
57335733+57345734+ JMAP Error Code: forbiddenFrom
57355735+57365736+ Intended use: common
57375737+57385738+ Change controller: IETF
57395739+57405740+ Reference: This document, Sections 6.3 and 7.5
57415741+57425742+ Description: The server does not permit the user to send a message
57435743+ with the From header field [RFC5322] of the message to be sent.
57445744+57455745+10.6.12. forbiddenToSend
57465746+57475747+ JMAP Error Code: forbiddenToSend
57485748+57495749+ Intended use: common
57505750+57515751+ Change controller: IETF
57525752+57535753+ Reference: This document, Section 7.5
57545754+57555755+ Description: The user does not have permission to send at all right
57565756+ now.
57575757+57585758+57595759+57605760+57615761+57625762+57635763+57645764+57655765+57665766+57675767+57685768+57695769+57705770+Jenkins & Newman Standards Track [Page 103]
57715771+57725772+RFC 8621 JMAP Mail August 2019
57735773+57745774+57755775+11. References
57765776+57775777+11.1. Normative References
57785778+57795779+ [HTML] Faulkner, S., Eicholz, A., Leithead, T., Danilo, A., and
57805780+ S. Moon, "HTML 5.2", World Wide Web Consortium
57815781+ Recommendation REC-html52-20171214, December 2017,
57825782+ <https://www.w3.org/TR/html52/>.
57835783+57845784+ [RFC1870] Klensin, J., Freed, N., and K. Moore, "SMTP Service
57855785+ Extension for Message Size Declaration", STD 10, RFC 1870,
57865786+ DOI 10.17487/RFC1870, November 1995,
57875787+ <https://www.rfc-editor.org/info/rfc1870>.
57885788+57895789+ [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
57905790+ Extensions (MIME) Part One: Format of Internet Message
57915791+ Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996,
57925792+ <https://www.rfc-editor.org/info/rfc2045>.
57935793+57945794+ [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions)
57955795+ Part Three: Message Header Extensions for Non-ASCII Text",
57965796+ RFC 2047, DOI 10.17487/RFC2047, November 1996,
57975797+ <https://www.rfc-editor.org/info/rfc2047>.
57985798+57995799+ [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
58005800+ Requirement Levels", BCP 14, RFC 2119,
58015801+ DOI 10.17487/RFC2119, March 1997,
58025802+ <https://www.rfc-editor.org/info/rfc2119>.
58035803+58045804+ [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded
58055805+ Word Extensions: Character Sets, Languages, and
58065806+ Continuations", RFC 2231, DOI 10.17487/RFC2231, November
58075807+ 1997, <https://www.rfc-editor.org/info/rfc2231>.
58085808+58095809+ [RFC2369] Neufeld, G. and J. Baer, "The Use of URLs as Meta-Syntax
58105810+ for Core Mail List Commands and their Transport through
58115811+ Message Header Fields", RFC 2369, DOI 10.17487/RFC2369,
58125812+ July 1998, <https://www.rfc-editor.org/info/rfc2369>.
58135813+58145814+ [RFC2392] Levinson, E., "Content-ID and Message-ID Uniform Resource
58155815+ Locators", RFC 2392, DOI 10.17487/RFC2392, August 1998,
58165816+ <https://www.rfc-editor.org/info/rfc2392>.
58175817+58185818+ [RFC2557] Palme, J., Hopmann, A., and N. Shelness, "MIME
58195819+ Encapsulation of Aggregate Documents, such as HTML
58205820+ (MHTML)", RFC 2557, DOI 10.17487/RFC2557, March 1999,
58215821+ <https://www.rfc-editor.org/info/rfc2557>.
58225822+58235823+58245824+58255825+58265826+Jenkins & Newman Standards Track [Page 104]
58275827+58285828+RFC 8621 JMAP Mail August 2019
58295829+58305830+58315831+ [RFC2852] Newman, D., "Deliver By SMTP Service Extension", RFC 2852,
58325832+ DOI 10.17487/RFC2852, June 2000,
58335833+ <https://www.rfc-editor.org/info/rfc2852>.
58345834+58355835+ [RFC3282] Alvestrand, H., "Content Language Headers", RFC 3282,
58365836+ DOI 10.17487/RFC3282, May 2002,
58375837+ <https://www.rfc-editor.org/info/rfc3282>.
58385838+58395839+ [RFC3461] Moore, K., "Simple Mail Transfer Protocol (SMTP) Service
58405840+ Extension for Delivery Status Notifications (DSNs)",
58415841+ RFC 3461, DOI 10.17487/RFC3461, January 2003,
58425842+ <https://www.rfc-editor.org/info/rfc3461>.
58435843+58445844+ [RFC3463] Vaudreuil, G., "Enhanced Mail System Status Codes",
58455845+ RFC 3463, DOI 10.17487/RFC3463, January 2003,
58465846+ <https://www.rfc-editor.org/info/rfc3463>.
58475847+58485848+ [RFC3464] Moore, K. and G. Vaudreuil, "An Extensible Message Format
58495849+ for Delivery Status Notifications", RFC 3464,
58505850+ DOI 10.17487/RFC3464, January 2003,
58515851+ <https://www.rfc-editor.org/info/rfc3464>.
58525852+58535853+ [RFC3834] Moore, K., "Recommendations for Automatic Responses to
58545854+ Electronic Mail", RFC 3834, DOI 10.17487/RFC3834, August
58555855+ 2004, <https://www.rfc-editor.org/info/rfc3834>.
58565856+58575857+ [RFC4314] Melnikov, A., "IMAP4 Access Control List (ACL) Extension",
58585858+ RFC 4314, DOI 10.17487/RFC4314, December 2005,
58595859+ <https://www.rfc-editor.org/info/rfc4314>.
58605860+58615861+ [RFC4422] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple
58625862+ Authentication and Security Layer (SASL)", RFC 4422,
58635863+ DOI 10.17487/RFC4422, June 2006,
58645864+ <https://www.rfc-editor.org/info/rfc4422>.
58655865+58665866+ [RFC4616] Zeilenga, K., Ed., "The PLAIN Simple Authentication and
58675867+ Security Layer (SASL) Mechanism", RFC 4616,
58685868+ DOI 10.17487/RFC4616, August 2006,
58695869+ <https://www.rfc-editor.org/info/rfc4616>.
58705870+58715871+ [RFC4865] White, G. and G. Vaudreuil, "SMTP Submission Service
58725872+ Extension for Future Message Release", RFC 4865,
58735873+ DOI 10.17487/RFC4865, May 2007,
58745874+ <https://www.rfc-editor.org/info/rfc4865>.
58755875+58765876+58775877+58785878+58795879+58805880+58815881+58825882+Jenkins & Newman Standards Track [Page 105]
58835883+58845884+RFC 8621 JMAP Mail August 2019
58855885+58865886+58875887+ [RFC4954] Siemborski, R., Ed. and A. Melnikov, Ed., "SMTP Service
58885888+ Extension for Authentication", RFC 4954,
58895889+ DOI 10.17487/RFC4954, July 2007,
58905890+ <https://www.rfc-editor.org/info/rfc4954>.
58915891+58925892+ [RFC5198] Klensin, J. and M. Padlipsky, "Unicode Format for Network
58935893+ Interchange", RFC 5198, DOI 10.17487/RFC5198, March 2008,
58945894+ <https://www.rfc-editor.org/info/rfc5198>.
58955895+58965896+ [RFC5248] Hansen, T. and J. Klensin, "A Registry for SMTP Enhanced
58975897+ Mail System Status Codes", BCP 138, RFC 5248,
58985898+ DOI 10.17487/RFC5248, June 2008,
58995899+ <https://www.rfc-editor.org/info/rfc5248>.
59005900+59015901+ [RFC5256] Crispin, M. and K. Murchison, "Internet Message Access
59025902+ Protocol - SORT and THREAD Extensions", RFC 5256,
59035903+ DOI 10.17487/RFC5256, June 2008,
59045904+ <https://www.rfc-editor.org/info/rfc5256>.
59055905+59065906+ [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321,
59075907+ DOI 10.17487/RFC5321, October 2008,
59085908+ <https://www.rfc-editor.org/info/rfc5321>.
59095909+59105910+ [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322,
59115911+ DOI 10.17487/RFC5322, October 2008,
59125912+ <https://www.rfc-editor.org/info/rfc5322>.
59135913+59145914+ [RFC5788] Melnikov, A. and D. Cridland, "IMAP4 Keyword Registry",
59155915+ RFC 5788, DOI 10.17487/RFC5788, March 2010,
59165916+ <https://www.rfc-editor.org/info/rfc5788>.
59175917+59185918+ [RFC6154] Leiba, B. and J. Nicolson, "IMAP LIST Extension for
59195919+ Special-Use Mailboxes", RFC 6154, DOI 10.17487/RFC6154,
59205920+ March 2011, <https://www.rfc-editor.org/info/rfc6154>.
59215921+59225922+ [RFC6409] Gellens, R. and J. Klensin, "Message Submission for Mail",
59235923+ STD 72, RFC 6409, DOI 10.17487/RFC6409, November 2011,
59245924+ <https://www.rfc-editor.org/info/rfc6409>.
59255925+59265926+ [RFC6532] Yang, A., Steele, S., and N. Freed, "Internationalized
59275927+ Email Headers", RFC 6532, DOI 10.17487/RFC6532, February
59285928+ 2012, <https://www.rfc-editor.org/info/rfc6532>.
59295929+59305930+ [RFC6533] Hansen, T., Ed., Newman, C., and A. Melnikov,
59315931+ "Internationalized Delivery Status and Disposition
59325932+ Notifications", RFC 6533, DOI 10.17487/RFC6533, February
59335933+ 2012, <https://www.rfc-editor.org/info/rfc6533>.
59345934+59355935+59365936+59375937+59385938+Jenkins & Newman Standards Track [Page 106]
59395939+59405940+RFC 8621 JMAP Mail August 2019
59415941+59425942+59435943+ [RFC6710] Melnikov, A. and K. Carlberg, "Simple Mail Transfer
59445944+ Protocol Extension for Message Transfer Priorities",
59455945+ RFC 6710, DOI 10.17487/RFC6710, August 2012,
59465946+ <https://www.rfc-editor.org/info/rfc6710>.
59475947+59485948+ [RFC7677] Hansen, T., "SCRAM-SHA-256 and SCRAM-SHA-256-PLUS Simple
59495949+ Authentication and Security Layer (SASL) Mechanisms",
59505950+ RFC 7677, DOI 10.17487/RFC7677, November 2015,
59515951+ <https://www.rfc-editor.org/info/rfc7677>.
59525952+59535953+ [RFC8098] Hansen, T., Ed. and A. Melnikov, Ed., "Message Disposition
59545954+ Notification", STD 85, RFC 8098, DOI 10.17487/RFC8098,
59555955+ February 2017, <https://www.rfc-editor.org/info/rfc8098>.
59565956+59575957+ [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
59585958+ 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
59595959+ May 2017, <https://www.rfc-editor.org/info/rfc8174>.
59605960+59615961+ [RFC8314] Moore, K. and C. Newman, "Cleartext Considered Obsolete:
59625962+ Use of Transport Layer Security (TLS) for Email Submission
59635963+ and Access", RFC 8314, DOI 10.17487/RFC8314, January 2018,
59645964+ <https://www.rfc-editor.org/info/rfc8314>.
59655965+59665966+ [RFC8457] Leiba, B., Ed., "IMAP "$Important" Keyword and
59675967+ "\Important" Special-Use Attribute", RFC 8457,
59685968+ DOI 10.17487/RFC8457, September 2018,
59695969+ <https://www.rfc-editor.org/info/rfc8457>.
59705970+59715971+ [RFC8474] Gondwana, B., Ed., "IMAP Extension for Object
59725972+ Identifiers", RFC 8474, DOI 10.17487/RFC8474, September
59735973+ 2018, <https://www.rfc-editor.org/info/rfc8474>.
59745974+59755975+ [RFC8620] Jenkins, N. and C. Newman, "The JSON Meta Application
59765976+ Protocol", RFC 8620, DOI 10.17487/RFC8620, June 2019,
59775977+ <https://www.rfc-editor.org/info/rfc8620>.
59785978+59795979+11.2. Informative References
59805980+59815981+ [EFAIL] Poddebniak, D., Dresen, C., Mueller, J., Ising, F.,
59825982+ Schinzel, S., Friedberger, S., Somorovsky, J., and J.
59835983+ Schwenk, "Efail: Breaking S/MIME and OpenPGP Email
59845984+ Encryption using Exfiltration Channels", August 2018,
59855985+ <https://www.usenix.org/system/files/conference/
59865986+ usenixsecurity18/sec18-poddebniak.pdf>.
59875987+59885988+ [milter] Postfix, "Postfix before-queue Milter support", 2019,
59895989+ <http://www.postfix.org/MILTER_README.html>.
59905990+59915991+59925992+59935993+59945994+Jenkins & Newman Standards Track [Page 107]
59955995+59965996+RFC 8621 JMAP Mail August 2019
59975997+59985998+59995999+ [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
60006000+ 4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003,
60016001+ <https://www.rfc-editor.org/info/rfc3501>.
60026002+60036003+ [RFC7489] Kucherawy, M., Ed. and E. Zwicky, Ed., "Domain-based
60046004+ Message Authentication, Reporting, and Conformance
60056005+ (DMARC)", RFC 7489, DOI 10.17487/RFC7489, March 2015,
60066006+ <https://www.rfc-editor.org/info/rfc7489>.
60076007+60086008+ [XCLIENT] Postfix, "Postfix XCLIENT Howto", 2019,
60096009+ <http://www.postfix.org/XCLIENT_README.html>.
60106010+60116011+Authors' Addresses
60126012+60136013+ Neil Jenkins
60146014+ Fastmail
60156015+ PO Box 234, Collins St. West
60166016+ Melbourne, VIC 8007
60176017+ Australia
60186018+60196019+ Email: neilj@fastmailteam.com
60206020+ URI: https://www.fastmail.com
60216021+60226022+60236023+ Chris Newman
60246024+ Oracle
60256025+ 440 E. Huntington Dr., Suite 400
60266026+ Arcadia, CA 91006
60276027+ United States of America
60286028+60296029+ Email: chris.newman@oracle.com
60306030+60316031+60326032+60336033+60346034+60356035+60366036+60376037+60386038+60396039+60406040+60416041+60426042+60436043+60446044+60456045+60466046+60476047+60486048+60496049+60506050+Jenkins & Newman Standards Track [Page 108]
60516051+