
Email MailExecution
CertifiedEmail a Flow execution summary
Email MailExecution
Email a Flow execution summary
Sends a templated email that links to the execution page and includes the execution ID, namespace, flow name, start time, duration, final status, and the failing task when applicable. Uses built-in HTML and text templates with executionId defaulting to the current run. Use this in Flow-trigger alerting scenarios and prefer MailSend for errors handlers; see alerting docs.
type: io.kestra.plugin.email.MailExecutionExamples
Send an email notification on a failed flow execution
id: failure_alert
namespace: company.team
tasks:
- id: send_alert
type: io.kestra.plugin.email.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.ExecutionStatus
in:
- FAILED
- WARNING
- type: io.kestra.plugin.core.condition.ExecutionNamespace
namespace: prod
prefix: true
Properties
accessToken string
OAuth2 access token
Used when transportStrategy is SMTP_OAUTH2. Overrides password when provided; otherwise password is treated as the token
attachments arraystring
Attachments
Attachments to include, provided as a list or JSON string. Shown as separate files; some clients preview common types inline
bcc string
BCC recipients
Optional semicolon-delimited RFC2822 addresses for blind carbon copy recipients
cc string
CC recipients
Optional semicolon-delimited RFC2822 addresses for carbon copy recipients
customFields object
Custom fields for the template
Additional key-value map merged into the email templates alongside the execution data
customMessage string
Custom message prefix
Optional freeform text appended to the rendered email body
embeddedImages arraystring
Embedded images
Images referenced from the HTML body via content IDs; accepts a list or JSON and expects common image MIME types
executionId string
{{ execution.id }}Execution ID to describe
Execution identifier injected into the templates. Defaults to the current execution when left blank
from string
Sender address
RFC2822 From address presented to recipients
host string
SMTP server host
Hostname or IP of the SMTP relay used to send emails
password string
SMTP password
Password or secret used for SMTP authentication
plainTextContent string
Plain text body
Plain-text alternative used when HTML is not supported
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
port integerstring
SMTP server port
Override the SMTP port. Defaults come from the transport strategy (SMTPS often 465, TLS 587)
sessionTimeout integerstring
10000Session timeout (ms)
Maximum socket timeout while sending emails. Defaults to 10000 ms (10 seconds)
subject string
Email subject
Optional subject line; template expressions are allowed
templateRenderMap object
Template variables
Key-value map injected into the templates during rendering
to string
Recipients (To)
Semicolon-delimited list of RFC2822 addresses for primary recipients
transportStrategy string
SMTPSSMTPSMTPSSMTP_TLSSMTP_OAUTH2SMTP transport strategy
Protocol used to send the email. Defaults to SMTPS; can be SMTP_TLS, SMTP, or SMTP_OAUTH2
trustedHosts array
Trusted SSL/TLS hosts
Restrict TLS trust to the specified hosts when working with internal or self-signed servers
username string
SMTP username
Username for authenticating to the SMTP server if required
verifyServerIdentity booleanstring
trueVerify server identity
Performs TLS server identity checks. Defaults to true; disable only for self-signed or internal servers