Send Email
Overview
Sends an email to each of up to 20 addresses
Category: Notifications
skedulo.tenant.comms.send) can save, activate, or run an automation that has this step. See Permissions.
Use this action to send an email to any email address. The step sends a separate plain-text email to each address, one at a time. The step finishes when the email service accepts the emails. It does not wait until the recipients get the emails. When the email service cannot send some of the emails, the step succeeds and lists those emails in errors. When the email service cannot send any email, the step fails. An automation that triggers on a received email event can handle a reply to this email. That event includes the conversation context and the related record.
Request
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
to |
array of string | Yes | The recipients’ addresses. Each address gets its own email Min items: 1 |
["jo@example.com","sam@example.com"] |
subject |
string | Yes | The subject line of the email | Your appointment on Tuesday |
body |
string | Yes | The plain-text body of the email. The email service does not render HTML | Hi Jo, your appointment is confirmed for Tuesday at 9am. |
from |
string | No | The label of the team email address to send from, exactly as written in the email settings, including capital letters. Without it, the email service sends from the team’s oldest active address. When no active address has this label, no email is sent | Support |
conversationContext |
object | No | Values to keep with the conversation. An automation that triggers on a reply reads them as metadata.conversationContext | {"jobId":"0014ccb7-73ad-40e1-9282-2c492a0f313a"} |
relatedRecord |
object | No | The record that the email is about, such as a Job. A search for the conversations of that record finds the email and its replies. | {"objectType":"Jobs","id":"0014ccb7-73ad-40e1-9282-2c492a0f313a"} |
Response
This action’s output is available as $sendEmail in JSONata expressions. See Response format for the standard result.data / result.errors structure and error handling patterns.
| Field | Type | Description |
|---|---|---|
result.data.messages |
array of object | One entry for each email that the email service accepted |
Permissions
Only a user with the Communications > Send email permission (skedulo.tenant.comms.send) can use this action. Skedulo checks the permission when a user does one of these tasks:
- Runs the action directly, without an automation.
- Saves, activates, or runs an automation that has a Send Email step.
When the user does not have the permission, Skedulo refuses the request with a 403 error. When the trigger of an active automation starts it, Skedulo does not check the permission again.
Choosing the sender
Use from to choose which address sends the email. Enter the label exactly as Settings > System administration > Communications shows it, with the same capital letters. See Manage addresses. When an administrator edits the step, the automation builder shows a list of the labels of the active addresses. Other users type the label.
When you do not set from, Skedulo sends from the oldest active address of your team. When no active address has the label in from, Skedulo does not send the emails, and the step fails. The step also fails when your team has no active address.
Recipients see the display name and the Skedulo address, for example Acme Plumbing <acme-7f3k2q@in.us.skedulo.com>. See How recipients see an email. A reply goes back to that address and joins the same conversation. An automation with the Email received trigger can start on the reply.
Linking the email to a record
Use relatedRecord to link each email to a record, for example a Job. Set objectType to the name of the object, for example Jobs, and set id to the UID of the record.
A reply to the email gets the same related record. An automation with the Email received trigger reads it in metadata.relatedRecord. Send Email always sets the namespace to dataModel. A custom object can have the same name as a Tempo record type, so the filter also checks the namespace. This filter starts the automation only for replies about Jobs:
metadata.relatedRecord.namespace == 'dataModel' AND metadata.relatedRecord.type == 'Jobs'
Values in conversationContext also come back on each reply, in metadata.conversationContext.
Reading the sent emails
result.data.messages has one entry for each email that the email service accepted:
| Field | Type | Description |
|---|---|---|
address |
string | The address of the recipient |
messageId |
string | The ID of the email message |
conversationId |
string | The ID of the conversation of the email. A reply to the email joins this conversation |
status |
string | submitted when the email provider accepted the email. submitting when the email service accepted the email but cannot confirm that the email provider sent it |
To find the entry for one recipient, use its address, not its position in to. For example, $sendEmail.result.data.messages[address = 'jo@example.com'].conversationId is the conversation of the email to jo@example.com.
When an email cannot be sent
The step sends each email separately. When the email service accepts at least one email, the step succeeds. The step puts an entry in result.errors for each email that it could not send. Each error message starts with the address of the recipient. When the email service accepts no email, the step fails.
The step does not try again to send an email that it could not send. This is also true when the email service says that a later attempt can send the email, for example when the email provider is busy (429), not available (503), or still sending an earlier request (409).
To find the emails that the step could not send, add a Choice step after the Send Email step, with this condition:
$count($sendEmail.result.errors) > 0
On that branch, read the errors in $sendEmail.result.errors, for example to create a task for a person.
Adding a retry
A Retry on the step runs only when the step fails, that is, when the step sent no email. The step also fails for reasons that a retry cannot fix, for example when no active address has the label in from. So keep MaxAttempts small. A retry sends again each email that failed for a temporary reason, for example a busy email provider or the send limit of your team. A retry does not send a second email to a recipient who already got one. A retry also does not send an email that the email provider refused.
The automation builder does not show a Retry setting. Add Retry to the step in the automation definition, and deploy the definition with the Skedulo CLI:
"SendReply": {
"Type": "Task",
"Resource": "action:send-email",
"Arguments": {
"to": "{% [$trigger.email.from.address] %}",
"subject": "{% 'Re: ' & $trigger.email.subject %}",
"body": "Thank you. We received your email."
},
"Retry": [
{ "ErrorEquals": ["States.ALL"], "IntervalSeconds": 60, "MaxAttempts": 3, "BackoffRate": 2 }
],
"End": true
}
A retry does not help when the step succeeds with some errors, because the step did not fail.
Sending to many recipients
Put all the recipients in to, up to 20 addresses. When to has the same address two times, the step sends one email to that address and adds one entry to messages. The repeated address still counts toward the limit of 20. The step compares the domain of each address without case. Do not put a Send Email step in a Map state of an automation definition. Each item of a Map state uses the same send key, so only the first item sends an email. The later items do not send an email.
Feedback
Was this page helpful?