JMAP
In case the input for a given DAG node is an email stream, the data for the given email will be in JMAP format with the key
being the message id and the value
the JMAP object.
You can read more about the JMAP Spec here but as it is not final yet we have listed here all the parameters we currently support for clarity.
Message object
Field | Type | Description |
---|---|---|
id | String | The id of the message. |
threadId | String | The id of the thread to which this message belongs. It can be empty if the server doesn’t support threading. |
mailboxIds | String[] | The ids of the mailboxes the message is in. |
inReplyToMessageId | String | null | The id of the Message this message is a reply to. This is primarily for drafts, but the server MAY support this for received messages as well by looking up the RFC2822 Message-Id referenced in the In-Reply-To header and searching for this message in the user’s mail. |
isUnread | Boolean | Has the message not yet been read? This corresponds to the opposite of the \Seen system flag in IMAP. |
isFlagged | Boolean | Is the message flagged? This corresponds to the \Flagged system flag in IMAP. |
isAnswered | Boolean | Has the message been replied to? This corresponds to the \Answered system flag in IMAP. |
isDraft | Boolean | Is the message a draft? This corresponds to the \Draft system flag in IMAP. |
hasAttachment | Boolean | Does the message have any attachments? |
headers | String[String] | A map of header name to (decoded) header value for all headers in the message. For headers that occur multiple times (e.g. Received), the values are concatenated with a single new line (\n) character in between each one. |
from | Emailer | null | An Emailer object containing the name/email from the parsed From header of the email. If the email doesn’t have a From header, this is null. |
to | Emailer[] | null | An array of Emailer objects representing the parsed To header of the email, in the same order as they appear in the header. If the email doesn’t have a To header, this is null. If the header exists but does not have any content, the response is an array of zero length. |
cc | Emailer[] | null | An array of Emailer objects representing the parsed Cc header of the email, in the same order as they appear in the header. If the email doesn’t have a Cc header, this is null. If the header exists but does not have any content, the response is an array of zero length. |
bcc | Emailer[] | null | An array of Emailer objects representing the parsed Bcc header of the email. If the email doesn’t have a Bcc header (which will be true for most emails outside of the Sent mailbox), this is null. If the header exists but does not have any content, the response is an array of zero length. |
replyTo | Emailer | null | An Emailer object containing the name/email from the parsed Reply-To header of the email. If the email doesn’t have a Reply-To header, this is null. |
subject | String | The subject of the message. |
date | Date | The date the message was sent (or saved, if the message is a draft). |
size | Number | The RFC822 size in bytes of the whole message as counted by the server towards the user’s quota. |
preview | String | null | Up to 256 characters of the beginning of a plain text version of the message body. This is intended to be shown as a preview line on a mailbox listing, and the server may choose to skip quoted sections or salutations to return a more useful preview. The server may decide to skip the preview altogether if it cannot reliably sanitise the email body. |
textBody | String | null | The plain text body part for the message if present and requested in wants of the sifts.json filter. |
htmlBody | String | null | The HTML body part for the message if present and requested in wants of the sifts.json filter. |
attachments | Attachment[] | null | An array of Attachment objects detailing all the attachments to the message. |
We have also added a few extensions to the JMAP specification to make data processing simpler, namely:
Field | Type | Description |
---|---|---|
strippedHtmlBody | String | null | The stripped HTML (the HTML tags are removed) body part for the message if requested in wants of the sifts.json filter. |
user | Emailer | The Sift user information, i.e.: {email: [email protected]} |
Emailer object
Field | Type | Description |
---|---|---|
name | String | The name of the sender/recipient. If a name cannot be extracted for an email, this property is an empty string. |
String | The email address of the sender/recipient. |
Attachment object
Field | Type | Description |
---|---|---|
blobId | String | The id of the attachment. When combined with the wants and large-storage environment variable this gives you the file to read the contents of the attachment from. |
type | String | The content-type of the attachment. |
name | String | The full file name, e.g. “myworddocument.doc” |
size | Number | The size, in bytes, of the attachment when fully decoded (i.e. the number of bytes in the file the user would download). |
isInline | Boolean | True if the attachment is referenced by a cid: link from within the HTML body of the message. |
Updated less than a minute ago