email/Messages
Collection of emails bound to email accounts and directories (for incoming emails).
The collection is created and used by the 'email' microservice.
Has type history or transactionlog, is partitioned and addressed using dates.
Entities for received emails are created automatically during IMAP directory synchronization with the IMAP server. Sent email entities are created via the API or by other system services.
Emails have states affecting the servicing process. Thus, to send an email the 'messageState' must be set to 'sending', and after sending it is automatically set to 'sent'. Additionally, for sending, the 'messageDirection' field must contain the value 'out'.
WARNING! All attachments, HTML content, and the native unparsed email content are saved as attachments and stored in the file system. This imposes restrictions on the file system, whose inode count may be quickly exhausted if it is initially limited at the attachment storage location.
Storage type: history or transactionlog.
| Field | Description |
|---|---|
|
Identifier. |
|
Parent email account identifier. |
|
Directory identifier. |
|
Email date-time. Also used when determining the DB storage partition. For sent emails, populated by the initiating service before sending, used when forming the queue. For received emails, populated automatically, predominantly the original time the email arrived on the server (Date or Delivery-Date headers). |
|
Email direction:
|
|
Email type:
|
|
Email state:
|
|
Populated with error content if the received email has the error state, or an error occurred during sending. |
|
Original IMAP set identifier (in received emails). Used to discover the next unreceived email. |
|
Original incremental email identifier within its IMAP uidValidity (in received emails). Used to discover the next unreceived email. |
|
Email sender address (in received emails) |
|
List of email recipient addresses. Populated automatically for received emails. Used when sending emails. |
|
List of other recipient email addresses via copy (for sent emails). |
|
List of hidden recipient email addresses (for sent emails). |
|
Email address for automatic reply. For sent emails, if the value is empty, the value from the account options (the 'options.replyTo' field) is taken, otherwise the destination address value ('to') is substituted. |
|
Email address to substitute into the In-Reply-To header of sent emails. |
|
Original email identifier (for received emails). |
|
Original email time (for received emails). Extracted from the Date or Delivery-Date headers. |
|
Date-time of actual reception of the incoming email from the mail server and entity creation. Populated automatically for received emails. |
|
|
|
Email subject. |
|
Message body if it is neither text nor html (for received emails). |
|
Message text if the content contains a text data block (text/plain directly or in multipart/alternative). For sent emails, populated by the initiator before sending. For received emails, populated automatically after successful email parsing. |
|
Email HTML content (attachment) if the content contains an html data block (text/html directly or in multipart/alternative). For sent emails, populated by the initiator before sending. For received emails, populated automatically after successful email parsing. The file is placed on disk; meta-information is saved in the entity. |
|
Message size (for received emails) |
|
List of attachments, including inline ones (multipart/mixed). For sent emails, populated by the initiator before sending. For received emails, populated automatically after successful email parsing. Attachments are placed on disk; meta-information is saved in the entity. |
|
Object - list of inline resources (resources with links from the email body). When sending an email, a specific set of parameters can be set using the object. In particular, the 'Content-Type' header value can be set for a specific attachment. For attachments requiring specific parameters, the object must contain a key - the file name in the 'attachments' collection, and a value - an object with a set of supported properties: 'content_type'. For example: {
"file.ics": {"content_type": "text/calendar; charset=utf-8; method=REQUEST; name=file.ics"}
}
|
|
Object - list of inline resources (resources with links from the email body). Placed in one 'multipart/related' part with the email HTML body. To send inline resources, specify an object where keys are Content-Ids and values are file names in the attachments collection. For example: {
"15623784-1562-3784-5906-156237845906": "myfile.png"
}
|
|
Original unparsed incoming email (for received emails). The file is placed on disk; meta-information is saved in the entity. |