email/Messages

A collection of emails bound to email accounts and directories (for inboxes). The collection is created and used by the microservice 'email'. Is of type history, partitioned and addressed using dates.

Entities for received emails are created automatically during synchronization of the IMAP directory with the IMAP server. Sent mail entities are created via API or other system services.

Letters have states that affect the service process. Thus, to send an email, the 'messageState' must be set to 'sending', and after sending it is automatically set to 'sent'. Additionally, to send, the 'messageDirection' field must contain a value of 'out'.

ATTENTION! All attachments, HTML content, and the native unattached content of the email are saved as attachments, stored in the file system. This introduces limitations on the file system, whose inodes can be quickly depleted if initially limited where attachments are stored.

Storage Type: history.

Table 1. Class fields
Field Description

id

Identifier.

account_id

folder_id

Identifier directory.

dateTime

The date-time of the e-mail. Used also when defining the storage partition in the database. For emails to be sent, it is filled in by the initiator service before sending, it is used in queuing. For received e-mails it is filled in automatically, predominantly the original time of receipt of the e-mail on the server (headers Date or Delivery-Date).

messageDirection

Letter Directions:

  • in - incoming mail.

  • out - outgoing/sent mail. It is a filter for the sending service.

messageType

Letter Type:

  • text - text

  • html - html document

  • alternative - The presence of alternatives (most often both text and html)

  • undefined - other content types

messageState

Writing condition:

  • sending - a letter ready to be sent. It is a filter for the sending service.

  • sent - letter sent.

  • error - sending error.

  • received - the letter you received.

  • raw - email received but not parsed due to a glitch.

  • undefined - unknown condition.

statusText

Filled with error content, if the received mail has error status, or the error occurred during sending.

uidValidity

The original IMAP set identifier (in received emails). Used to detect the next unreceived email.

uid

The original incremental email identifier within its IMAP uidValidity (in received emails). Used to detect the next unreceived email.

from

Email-address of the sender of the letter (in received letters)

to

A list of email addresses of the recipients of the email. Automatically populated for emails received. Used when sending letters.

copy

A list of email addresses of other recipients of the email via copy (for emails that are sent).

blindCopy

List of email addresses of hidden recipients (for sent emails).

replyTo

Email-address for automatic reply. For sent emails, if the value is empty, the value from the account options (field 'options.replyTo') is taken, and otherwise the value of the destination address is substituted ('to').

inReplyTo

Email-address to be inserted in the In-Reply-To header of emails to be sent.

nativeId

Original email ID (for received emails).

nativeDateTime

The original time of the email (for received emails). Extracted from the Date or Delivery-Date.

recvDateTime

Date-Time when the incoming email was actually received from the mail server and the entity was created. Filled in automatically for letters received.

references

subject

Post subject line.

body

The body of the message if it is not text or html (for received emails).

bodyText

Message text, if text data is present in the block content (text/plain directly or in the multipart/alternative). For mailable letters, to be filled in by the initiator before sending. For received emails, it is automatically populated after the email has been successfully parsed.

html

HTML email content (attachment), if there is html data in the content of the html block (text/html directly or in the multipart/alternative). For mailable letters, to be filled in by the initiator before sending. For received emails, it is automatically populated after the email has been successfully parsed. The file is placed on disk, essentially storing meta-information.

size

Message size (for received e-mails)

attachments

List of attachments, including inlays (multipart/mixed). For mailable letters, to be filled in by the initiator before sending. For received emails, it is automatically populated after the email has been successfully parsed. Attachments are placed on disk, essentially storing meta-information.

attachmentInfo

Object - list of inlines (resources with links from the body of the email). When sending an email using an object, a specific set of parameters can be set. In particular, you can set a header value for a particular attachment 'Content-Type'. For attachments that require specific parameters to be specified, the object must contain a key - the name of the file 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"}
}

inlineInfo

Object - list of inlines (resources with links from the body of the email). They are placed in the same 'multipart/related' part of the HTML body of the email. To send inlines, you should specify an object where the keys are Content-Id and the values are the file names in the collection attachments.

For example:

{
  "15623784-1562-3784-5906-156237845906": "myfile.png"
}

rawMessage

The original unopened incoming email (for received emails). The file is placed on disk, essentially storing meta-information.