Skip to main content
Version: Current

Email

Mode: Streaming Mode: Request-Response

Description​

Sends one HTML e-mail per event through the SMTP relay configured for the component, and puts the Message-ID of the sent message into the output variable. Every node keeps its connections to the relay (connections, 1 by default) open between messages and reconnects when the relay closed one.

In scenario tests nothing is sent: the node records the message (sender, recipients, subject) and its output variable gets a placeholder Message-ID starting with not-sent-in-test-.

A message that cannot be sent - a recipient that is not an e-mail address, no recipient at all, the relay rejecting it - is an error of the event, handled like any other runtime error of the scenario.

Parameters​

NameDescription
ToList of recipient addresses, e.g. {#input.email}. Empty items are skipped; at least one address is required.
CcList of copy addresses; {} for none.
SenderName <name@example.com>. Leave it empty to send as the configured default sender.
SubjectTemplate; #{...} embeds an expression, e.g. Your card expires on #{#input.expiryDate}.
ContentHTML body of the message, a template like Subject.
HeadersAdvanced. Extra headers as {name, value} records, e.g. {{name: 'Reply-To', value: 'support@example.com'}}. A name may repeat.

Headers that the component sets itself (From, Sender, To, Cc, Bcc, Subject, Date, Message-ID, MIME-Version, Content-Type, Content-Transfer-Encoding) cannot be added, and a value with a line break is rejected; either fails the event like an invalid recipient.

The sender is checked when the scenario is validated: it must be an e-mail address and, when the component has an allowed sender pattern, its address (without the name) has to match it.

Configuration​

The component is not available until it is configured, once per SMTP relay: in the Integrations tab or in the model configuration.

In the Integrations tab​

Add an Email (SMTP) integration in the Integrations tab. It needs the Edit permission for integrations, and its component is available in streaming and request-response scenarios. The integration's name becomes the name of the component in the palette, so each relay - or each set of senders - is its own component.

The form holds the same settings as the configuration below: the SMTP host, port, security, username, password and connection timeout, the number of connections, the default sender, the allowed sender pattern and the charset. Check connection connects to the relay with these settings and logs in when a username is set; nothing is sent.

The password is a secret: users who can only view integrations see it masked, and scenario authors use the component without seeing it. Everyone who edits scenarios can send through the relay, though, so set the allowed sender pattern to the domains the relay may send for - the form warns while it is empty.

Amazon SES​

The Amazon SES integration sends through the SES SMTP endpoint of a region and adds two parameters to the node:

NameDescription
Configuration setOne of the account's configuration sets, or None. Sent as X-SES-CONFIGURATION-SET. A configuration set is defined in AWS: its event destinations (SNS, EventBridge, Firehose, CloudWatch) get the message's events (delivery, bounce, complaint, open, click), and opens and clicks are tracked only when it enables that. With None no set is named: SES applies the default configuration set of the sender's identity if one is assigned to it, and the identity's own bounce and complaint notifications still apply.
Message tags{name, value} records, e.g. {{name: 'campaign', value: 'spring'}, {name: 'customer', value: #input.id}}, sent as X-SES-MESSAGE-TAGS. SES adds them to the events. Names and values may hold only letters, digits, _ and -, at most 50 tags; a name may repeat.

The integration takes the region and the access key of an IAM user. That one user can both send and read the configuration sets: the SMTP password is derived from its secret access key, as AWS documents for SES SMTP credentials, unless an SMTP password is given. Give the user only ses:SendRawEmail and ses:ListConfigurationSets: a secret access key allows more than an SMTP password. The SMTP host, port, username and password can be changed, e.g. to send through a Mail Manager ingress endpoint; whether the SES headers take effect there depends on its rules.

The list of configuration sets is read from the account when the connection is checked in the integration form, when the Designer starts, and with the refresh icon inside the Configuration set field of the node, which needs the View permission on integrations. A node whose configuration set was removed from the account fails validation.

The list is read from https://email.<region>.amazonaws.com. To read it from elsewhere for every region, e.g. a VPC endpoint or LocalStack, set configurator.amazonSes.apiEndpoint: "https://..." in the Designer configuration.

In the model configuration​

scenarioTypes.streaming.modelConfig.components.email {
providerType: "email"
smtp {
host: "smtp.example.com"
port: 587 # default 25
username: "campaigns" # optional; authentication is used only when it is set
password: ${?SMTP_PASSWORD}
security: "starttls" # none (default), starttls or ssl
connectionTimeout: 10s # connect, read and write timeout, from 1ms to 24 days
connections: 1 # SMTP connections of each running instance of the node; mind the relay's rate limit.
# With more than 1, messages go out roughly, not strictly, in event order
}
defaultSender: "Campaigns <campaigns@example.com>" # optional
allowedSenderPattern: ".*@example\\.com" # optional regex the sender address has to match
charset: "UTF-8" # of the subject and the body
# optional: headers set through parameters of their own
headerParameters: [
{ header: "X-Campaign", label: "Campaign", values: ["spring", "summer"] } # a list to pick from, or none
{ header: "X-Labels", label: "Labels", format: "pairs", pattern: "[a-z]+", maxPairs: 10 } # name=value, name=value
]
}

With componentPrefix set, several relays can be configured side by side, each as its own component.

Metrics​

Like the other enrichers, the component times every message it hands to the relay with the service.OK and service.FAIL metrics, tagged serviceName=email (see Common metrics), so it shows on the service panels of the scenario dashboards. The time runs from handing the message to the node's SMTP connection until the relay answers, including any wait for the connection. A message whose parameters fail before it is sent, and a message recorded in a scenario test, are not timed.