Email MailExecution

Email MailExecution

Certified

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.

yaml
type: io.kestra.plugin.email.MailExecution

Send an email notification on a failed flow execution

yaml
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

OAuth2 access token

Used when transportStrategy is SMTP_OAUTH2. Overrides password when provided; otherwise password is treated as the token

Attachments

Attachments to include, provided as a list or JSON string. Shown as separate files; some clients preview common types inline

BCC recipients

Optional semicolon-delimited RFC2822 addresses for blind carbon copy recipients

CC recipients

Optional semicolon-delimited RFC2822 addresses for carbon copy recipients

Custom fields for the template

Additional key-value map merged into the email templates alongside the execution data

Custom message prefix

Optional freeform text appended to the rendered email body

Embedded images

Images referenced from the HTML body via content IDs; accepts a list or JSON and expects common image MIME types

Default{{ execution.id }}

Execution ID to describe

Execution identifier injected into the templates. Defaults to the current execution when left blank

Sender address

RFC2822 From address presented to recipients

SMTP server host

Hostname or IP of the SMTP relay used to send emails

SMTP password

Password or secret used for SMTP authentication

Plain text body

Plain-text alternative used when HTML is not supported

Reference (ref) of the pluginDefaults to apply to this task.

SMTP server port

Override the SMTP port. Defaults come from the transport strategy (SMTPS often 465, TLS 587)

Default10000

Session timeout (ms)

Maximum socket timeout while sending emails. Defaults to 10000 ms (10 seconds)

Email subject

Optional subject line; template expressions are allowed

Template variables

Key-value map injected into the templates during rendering

Recipients (To)

Semicolon-delimited list of RFC2822 addresses for primary recipients

DefaultSMTPS
Possible Values
SMTPSMTPSSMTP_TLSSMTP_OAUTH2

SMTP transport strategy

Protocol used to send the email. Defaults to SMTPS; can be SMTP_TLS, SMTP, or SMTP_OAUTH2

SubTypestring

Trusted SSL/TLS hosts

Restrict TLS trust to the specified hosts when working with internal or self-signed servers

SMTP username

Username for authenticating to the SMTP server if required

Defaulttrue

Verify server identity

Performs TLS server identity checks. Defaults to true; disable only for self-signed or internal servers