Email processor (email)

Description

Processor for exchanging email messages with mail servers.

Provides communication with mail servers (IMAP, SMTP). Monitors enabled IMAP folders and places messages received from senders into the data model collection /rest/v1/model/email/Messages, and sends messages created there with `sending` status to recipients via SMTP.

Creates collections/classes: email/Profiles, email/Accounts, email/Folders, email/Messages. Allows their further modification to extend the set of properties and the value variants of enumerated fields.

Interaction with external business logic is performed using message statuses (`sending`, `sent`, `error`, `received`, `raw`).

Table 1. System characteristics

Code

email

Operation mode

Service

Redundancy mode

Active-Passive.

Site types

Any

Layer

Adapter/processor

Placement

Internal

State preservation and recovery on restart

No

Application

era_email

Capabilities

  • Email messages can be text, HTML, or contain both alternative variants.

  • Attachments are stored as attachments to the email/Messages entity (file field) and are available via /rest/v1/model/email/Messages/ID_MESSAGE/attachments.

  • HTML content is also stored as an attachment in the html field and is available via /rest/v1/model/email/Messages/ID_MESSAGE/html.

  • All inlines (files used within HTML) are stored as attachments in the inlines field and are available via /rest/v1/model/email/Messages/ID_MESSAGE/inlines.

  • When a message is received, its original RFC822 content is stored in the entity in the rawMessage field as an attachment and is available via /email/Message and via /rest/v1/model/email/Messages/ID_MESSAGE/rawMessage.

  • If a message cannot be parsed and decomposed into fields, its unparsed content is stored and the special `raw` status is set.

  • When an account is created (/rest/v1/model/email/Accounts) and a corresponding profile exists (/rest/v1/model/email/Profiles), it polls the folder composition and places them in disabled form in the email/Folders collection. After a folder is enabled, it is monitored for incoming messages, and the email/Messages collection is monitored with a filter by folder for messages ready to be sent.

Limitations

  • Operates in periodic IMAP server polling mode for incoming messages. The timeout between polls is 30 seconds by default. Controlled by the `after_read_timeout` value in the options field in descending order: /email/Folder, /email/Account, /email/Profile.

  • Deletion of messages in the IMAP folder is controlled by the `deleteOnServer` parameter of the folder entity.

Parameters

Table 2. Parameters
Name Type Default Description

name

str

required

Name. May consist of Latin letters and digits and must start with a letter.

roletype

str

required

Role type. Possible values: "email".

ext

json

empty

Additional role options. Contains a JSON object or list.

enabled

bool

empty

Role activity flag. When set to false, the role does not participate in validation and is not started.

limit_of_cores

int

empty

Limit on the number of CPU logical cores used. Default: 0 - unlimited.

logging_default_level

int

empty

Default logging level set specifically for the role instance (microservice type). More

allow_divergence

bool

false

Flag allowing parameter differences in roles of the same group. Default: false - not allowed.

group

int

required

Group number.
As part of horizontal scaling, the role can be split into several groups on a site, in each of which only one instance is active and the rest are standby.
Responsibility is divided between groups by domain sets. Together all groups serve the full domain set. All roles in one group must have the same responsibility.
An integer from 1 to 9999999.

order

int

required

Order of the role instance within the group.
Determines the order in which takeover occurs in Active-Passive mode.

include_domains

array<str>

empty

List of domain names served by this group.
Any domain of any level can be specified. Specifying a domain causes its subtree to be served on this group and not on other role groups, except for branches mentioned in other groups.
Together, all role groups on the site serve the full domain tree.

takeover

bool

global

Takeover mode switch.

Failover - activation of a lower-priority service instance when the higher-priority service instance (leader of the active-passive group) is detected as unavailable.
Takeover - activation of the higher-priority service instance (leader of the active-passive group) during its recovery, accompanied by stopping the service on the lower-priority service instance.

  • If the mode is enabled, takeover is performed automatically.

  • If the mode is disabled, takeover is not performed; the recovered group leader temporarily becomes a follower and waits for the service to be unloaded on the lower-priority instance.

  • If the option is not set, its value from the current site parameters is used. If it is not set on the site, the value from the general section is used. If it is not set anywhere, takeover is enabled for more accurate load distribution according to the configured priorities.

domain_group

int

group

Domain distribution group number. Instances with the same value share the domain subtree (include_domains) as one group. Defaults to the group number.
An integer from 0.

Configuration example

Configuration management is performed in an application available to master domain administrators. The application hides the full configuration content, but it is still available through the API.

The configuration contains a section describing all instances of all roles. Parameters are defined for each specific role instance.

Node example
{
  "name": "im1",
  "roletype": "im",

  "group": 11330,
  "order": 1
}

See also