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

Sender address

RFC2822 From address presented to recipients

Recipients (To)

Semicolon-delimited list of RFC2822 addresses for primary recipients

OAuth2 access token

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

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

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

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

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

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