Skip to content

Email

Capability: urn:ietf:params:jmap:mail

Accepts result references: #ids from Email/query (path /ids)

Arguments

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account to fetch emails from.
idsEmailId[]NoIDs of the emails to fetch. Omit or pass null to fetch all (subject to limit).
propertiesstring[]NoEmail properties to include in the response. Omit for all properties.
bodyPropertiesstring[]NoProperties to include for each body part object. Defaults to a standard set.
fetchTextBodyValuesbooleanNoIf true, fetch the value of text/plain body parts.
fetchHTMLBodyValuesbooleanNoIf true, fetch the value of text/html body parts.
fetchAllBodyValuesbooleanNoIf true, fetch all body part values regardless of content type.
maxBodyValueBytesintegerNoTruncate body values to this many bytes. 0 means no truncation.
fetchHeadersstring[]NoList of specific header field names to return as header: values.
fetchAllHeadersboolean?NoIf true, return all raw headers regardless of fetchHeaders list.

Response

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account the emails belong to.
statestringYesThe current state of the Email type. Pass to Email/changes to detect future changes.
listEmailExt[]YesThe list of Email objects that were requested and found.
notFoundanyNoIDs from the request that could not be found, or null if all were found.

Capability: urn:ietf:params:jmap:mail

Arguments

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account to fetch changes for.
sinceStatestringYesThe state string from the last Email/get or Email/changes response. Only changes after this state are returned.
maxChangesintegerNoMaximum number of change records to return. Omit for no limit. If exceeded, hasMoreChanges will be true.

Response

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account these changes belong to.
oldStatestringYesThe state this response starts from (matches sinceState from the request).
newStatestringYesThe current state after all listed changes; pass to the next call.
hasMoreChangesbooleanYesIf true, additional changes exist beyond maxChanges. Call again with newState.
createdEmailId[]YesIDs of emails created since sinceState.
updatedEmailId[]YesIDs of emails whose properties changed since sinceState.
destroyedEmailId[]YesIDs of emails destroyed since sinceState.

Capability: urn:ietf:params:jmap:mail

Provides result references: /ids

Arguments

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account to query.
filterobjectNoOptional filter conditions to narrow results (e.g. inMailbox, from, subject).
sortobject[]NoSort criteria. Each object has a property name and isAscending flag. Defaults to date descending.
positionintegerNoZero-based index of the first result to return. Cannot be combined with anchor.
anchorstring?NoEmailId to use as the anchor for pagination. The page starts at this email.
anchorOffsetintegerNoOffset in results relative to the anchor. Negative values move backwards.
limitintegerNoMaximum number of EmailIds to return. Defaults to server maximum.
calculateTotalbooleanNoIf true, compute the total number of matching emails (may be slower).
collapseThreadsbooleanNoIf true, return only the latest email per thread, de-duplicating results.

Response

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account this query result belongs to.
queryStatestringYesOpaque state string for this query. Pass to Email/queryChanges to detect changes to the result set.
canCalculateChangesbooleanYesWhether Email/queryChanges is supported for this query.
positionintegerYesZero-based index of the first ID in the full result list.
idsEmailId[]YesEmailIds of the results for this page, in the requested sort order.
totalintegerNoTotal number of matching emails. Only present when calculateTotal was true.
limitintegerNoThe limit applied by the server (may be lower than the requested limit).
anchorstringNoThe anchor EmailId used for this page, if anchor-based pagination was requested.

Capability: urn:ietf:params:jmap:mail

Arguments

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account to check for query changes.
filterobjectNoMust match the filter used in the original Email/query call.
sortobject[]NoMust match the sort used in the original Email/query call.
sinceQueryStatestringYesThe queryState from the previous Email/query or Email/queryChanges response.
maxChangesintegerNoMaximum number of changes to return. If exceeded, hasMoreChanges will be true.
upToIdEmailIdNoReturn changes only up to and including this EmailId.

Response

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account these query changes belong to.
oldQueryStatestringYesThe queryState this response starts from (matches sinceQueryState from request).
newQueryStatestringYesThe current queryState. Pass to the next Email/queryChanges call.
hasMoreChangesbooleanYesIf true, more changes exist beyond maxChanges. Call again with newQueryState.
removedEmailId[]YesEmailIds that are no longer in the query result set.
addedobject[]YesEmails that are now in the result set, with their new positions.
totalintegerNoUpdated total count of results (if calculateTotal was true in the original query).
upToIdEmailIdNoEchoes the upToId from the request, if provided.

Capability: urn:ietf:params:jmap:mail

Arguments

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account to apply changes to.
ifInStatestring?NoOptimistic concurrency guard; the call fails with stateMismatch if the Email state has changed.
createobjectNoMap of client-assigned creation ids to Email objects.
updateobjectNoMap of EmailId to PatchObject.
destroyEmailId[]NoList of EmailIds to permanently delete.

Response

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account the changes were applied to.
oldStatestringYesThe Email state before this set operation.
newStatestringYesThe Email state after this set operation.
createdobject?NoSuccessfully created emails, keyed by the client-assigned creation id.
updatedobject?NoMap of successfully updated EmailId to null.
destroyedanyNoIDs of successfully destroyed emails, or null if none.
notCreatedobject?NoCreation ids that failed, with a SetError describing the reason.
notUpdatedobject?NoEmailIds that failed to update, with a SetError describing the reason.
notDestroyedobject?NoEmailIds that failed to destroy, with a SetError describing the reason.

Capability: urn:ietf:params:jmap:mail

Arguments

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account to import into.
ifInStatestring?NoOptimistic concurrency guard on the Email state.
emailsobjectYesMap of client-assigned creation ids to ImportEmailObject.

Response

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account the emails were imported into.
oldStatestring?YesThe state before the import.
newStatestringYesThe state after the import.
createdobject?NoMap of creation id to created Email object (subset of properties).
notCreatedobject?NoMap of creation id to SetError for failed imports.

Capability: urn:ietf:params:jmap:mail

Arguments

PropertyTypeRequiredDescription
fromAccountIdAccountIdYesThe account to copy emails from.
ifFromInStatestring?NoOptimistic concurrency guard on the source Email state.
accountIdAccountIdYesThe account to copy emails into.
ifInStatestring?NoOptimistic concurrency guard on the destination Email state.
createobjectYesMap of client-assigned creation ids to objects describing the copy.
onSuccessDestroyOriginalboolean?NoIf true, destroy original emails on success. Default: false.
destroyFromIfInStatestring?NoGuard on source state when destroying originals.

Response

PropertyTypeRequiredDescription
fromAccountIdAccountIdYesThe account the emails were copied from.
accountIdAccountIdYesThe account the emails were copied into.
oldStatestring?YesThe Email state before the copy, or null if the destination account had no prior state.
newStatestringYesThe Email state after the copy.
createdobject?NoMap of creation id to created Email object (subset: id, blobId, threadId, size).
notCreatedobject?NoMap of creation id to SetError for failed copies.

Capability: urn:ietf:params:jmap:mail

Arguments

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account whose blob store to parse from.
blobIdsBlobId[]YesBlob ids of the messages to parse.
propertiesarray?NoEmail properties to return. Defaults to all properties.
bodyPropertiesarray?NoBody part properties to include.
fetchTextBodyValuesboolean?NoIf true, include values for text/plain body parts.
fetchHTMLBodyValuesboolean?NoIf true, include values for text/html body parts.
fetchAllBodyValuesboolean?NoIf true, include values for all body parts.
maxBodyValueBytesinteger?NoTruncate body values to this byte length.

Response

PropertyTypeRequiredDescription
accountIdAccountIdYesThe account the blobs were parsed from.
parsedobject?NoMap of blob id to parsed Email object.
notParsablearray?NoBlob ids that could not be parsed as RFC 5322 messages.
notFoundarray?NoBlob ids not found in the account.