Send an email
Sends an email to a list of recipient email addresses.
Description
This step enables sending an email with customized content to a defined set of destination email addresses. For scenarios where multiple email addresses are provided, you can configure whether to send the email to all specified recipients or only to the first recipient for whom the email is successfully sent.
Recipients are specified using an expression that evaluates to a set of email addresses at runtime. Both the email body and subject can include dynamic content, allowing for customization based on your journey’s context.
When executed, the action sends an email with the specified body and subject to the resolved recipient email addresses. Additionally, the result of this action can be stored in a configured output variable for use in subsequent journey steps.
To send emails, you can configure either the SMTP service, or configure Custom Web Services to handle email distribution.
Configuration
Parameter | Description |
---|---|
Recipient selection strategy | Defines how recipients are chosen from the list resolved by the Recipients expression (if it resolves to multiple email addresses):
|
Recipients | An expression that resolves to one or more email addresses, provided as a string or an array of strings. |
Message body | The content of the email to send. Supports dynamic content through interpolation. |
Email service | Select the email service from the list of external connections:
|
Subject | The subject line of the email. Supports dynamic content through interpolation. |
Output variable | The variable to store the result data from the completed action, making it available for use in subsequent journey steps. The result includes:
|
Example
In this example, the step sends a personalized alert email to a group of administrators, notifying them about potential security threats detected in their app by Fraud detection services, such as frequent bot attacks or multiple login attempts from the same IP using different devices.
The step is configured as follows:
-
Recipients
: A list of email addresses to which the alert will be sent. Example:
["admin1@example.com", "admin2@example.com", "securityteam@example.com"]
. - Recipient selection strategy : Defines how recipients are selected. Options include sending to all recipients or stopping after the first successful delivery. Example: All recipients .
-
Message body
: The content of the email, supporting dynamic placeholders for personalized details. Example:
Alert: A potential security threat has been detected in the {appName} application due to {eventType}. Please investigate immediately.
-
Email service
: A custom web service for email distribution named
testEmailService
. -
Subject
: The subject line of the email, supporting dynamic placeholders for context. Example:
Security Alert for {appName}
. -
Output variable
: A variable to store the result of the email notification action, which can be used in subsequent journey steps. Example:
emailNotificationResult
.
When the conditions for triggering the step are met, the step executes and sends the email to all specified recipients. The emailNotificationResult
variable is populated with results indicating that all emails were successfully sent:
{
"type": "success",
"successEmails": ["admin1@example.com", "admin2@example.com", "securityteam@example.com"]
}
You can use the output variable in subsequent steps to handle the following scenarios:
-
If
type
isfailure
: Trigger a fallback to notify the event through another channel (e.g., SMS or a phone call). -
If
type
ispartial
: Retry sending only to recipients not included insuccessEmails
. -
If
type
issuccess
: Proceed with the next step of the journey without additional actions.