MailExecution
MailExecution
type: "io.kestra.plugin.notifications.mail.MailExecution"
Send an email with the execution information
The message will include a link to the execution page in the UI along with the execution ID, namespace, flow name, the start date, duration and the final status of the execution, and (if failed) the task that led to a failure.
Use this notification task only in a flow that has a Flow trigger, as shown in this example. Don't use this notification task in errors
tasks. Instead, for errors
tasks, use the MailSend task.
Examples
Send an email notification on a failed flow execution
id: failure_alert
namespace: company.team
tasks:
- id: send_alert
type: io.kestra.plugin.notifications.mail.MailExecution
to: hello@kestra.io
from: hello@kestra.io
subject: "The workflow execution {{trigger.executionId}} failed for the flow {{trigger.flowId}} in the namespace {{trigger.namespace}}"
host: mail.privateemail.com
port: 465
username: "{{ secret('EMAIL_USERNAME') }}"
password: "{{ secret('EMAIL_PASSWORD') }}"
executionId: "{{ trigger.executionId }}"
triggers:
- id: failed_prod_workflows
type: io.kestra.plugin.core.trigger.Flow
conditions:
- type: io.kestra.plugin.core.condition.ExecutionStatusCondition
in:
- FAILED
- WARNING
- type: io.kestra.plugin.core.condition.ExecutionNamespaceCondition
namespace: prod
prefix: true
Properties
attachments
- Type: array
- SubType: MailSend-Attachment
- Dynamic: ✔️
- Required: ❌
Adds an attachment to the email message
The attachment will be shown in the email client as separate files available for download, or displayed inline if the client supports it (for example, most browsers display PDF's in a popup window)
cc
- Type: string
- Dynamic: ✔️
- Required: ❌
One or more 'Cc' (carbon copy) optional recipient email address. Use semicolon as delimiter to provide several addresses
Note that each email address must be compliant with the RFC2822 format
customFields
- Type: object
- Dynamic: ✔️
- Required: ❌
Custom fields to be added on notification
customMessage
- Type: string
- Dynamic: ✔️
- Required: ❌
Custom message to be added on notification
embeddedImages
- Type: array
- SubType: MailSend-Attachment
- Dynamic: ✔️
- Required: ❌
Adds image data to this email that can be referred to from the email HTML body
The provided images are assumed to be of MIME type png, jpg or whatever the email client supports as valid image that can be embedded in HTML content
executionId
- Type: string
- Dynamic: ✔️
- Required: ❌
- Default:
{{ execution.id }}
The execution id to use
Default is the current execution, change it to {{ trigger.executionId }} if you use this task with a Flow trigger to use the original execution.
from
- Type: string
- Dynamic: ✔️
- Required: ❌
The address of the sender of this email
host
- Type: string
- Dynamic: ✔️
- Required: ❌
The email server host
htmlTextContent
- Type: string
- Dynamic: ✔️
- Required: ❌
The optional email message body in HTML text
Both text and HTML can be provided, which will be offered to the email client as alternative contentEmail clients that support it, will favor HTML over plain text and ignore the text body completely
password
- Type: string
- Dynamic: ✔️
- Required: ❌
The email server password
plainTextContent
- Type: string
- Dynamic: ✔️
- Required: ❌
The optional email message body in plain text
Both text and HTML can be provided, which will be offered to the email client as alternative contentEmail clients that support it, will favor HTML over plain text and ignore the text body completely
port
- Type:
- integer
- string
- Dynamic: ✔️
- Required: ❌
sessionTimeout
- Type:
- integer
- string
- Dynamic: ✔️
- Required: ❌
subject
- Type: string
- Dynamic: ✔️
- Required: ❌
The optional subject of this email
templateRenderMap
- Type: object
- Dynamic: ✔️
- Required: ❌
Map of variables to use for the message template
to
- Type: string
- Dynamic: ✔️
- Required: ❌
Email address(es) of the recipient(s). Use semicolon as delimiter to provide several email addresses
Note that each email address must be compliant with the RFC2822 format
transportStrategy
- Type: string
- Dynamic: ✔️
- Required: ❌
- Default:
SMTPS
- Possible Values:
SMTP
SMTPS
SMTP_TLS
SMTP_OAUTH2
The optional transport strategy
Will default to SMTPS if left empty
username
- Type: string
- Dynamic: ✔️
- Required: ❌
The email server username
Outputs
Definitions
io.kestra.plugin.notifications.mail.MailSend-Attachment
Properties
contentType
- Type: string
- Dynamic: ✔️
- Required: ✔️
- Default:
application/octet-stream
One or more 'Cc' (carbon copy) optional recipient email address(es). Use semicolon as a delimiter to provide several addresses
Note that each email address must be compliant with the RFC2822 format
name
- Type: string
- Dynamic: ✔️
- Required: ✔️
The name of the attachment (eg. 'filename.txt')
uri
- Type: string
- Dynamic: ✔️
- Required: ✔️
An attachment URI from Kestra internal storage
Was this page helpful?