New to Kestra?
Use blueprints to kickstart your first workflows.
Send automatic Gmail email alerts whenever a Kestra workflow execution fails or warns, with a single reusable flow that centralizes failure notifications.
id: failure-alert-gmail
namespace: system
tasks:
- id: notify
type: io.kestra.plugin.email.MailSend
from: alerts@example.com
to: team@company.com
username: "{{ secret('G_EMAIL') }}"
password: "{{ secret('G_APP_PASSWORD') }}"
host: smtp.gmail.com
port: 465
subject: Failed Execution - {{ trigger.executionId }}
htmlTextContent: "{{ trigger.executionId }}"
triggers:
- id: on_failure
type: io.kestra.plugin.core.trigger.Flow
conditions:
- type: io.kestra.plugin.core.condition.ExecutionStatus
in:
- FAILED
- WARNING
Catch failed pipelines the moment they break. This system flow sends a Gmail email alert whenever any workflow execution in your Kestra instance ends in a FAILED or WARNING state, so your team learns about broken runs from their inbox instead of from a downstream consumer. Instead of wiring error handling into every flow, you define one centralized failure-alerting pattern that watches all executions and routes notifications through Gmail SMTP. This removes the silent-failure gap that leaves bad data, stalled jobs, and missed SLAs undiscovered until it is too late.
io.kestra.plugin.core.trigger.Flow) listens to executions across the instance.io.kestra.plugin.core.condition.ExecutionStatus condition filters those events to only FAILED and WARNING statuses, so healthy runs stay quiet.notify task (io.kestra.plugin.email.MailSend) connects to smtp.gmail.com on port 465 and sends an email.subject and htmlTextContent interpolate {{ trigger.executionId }}, so each alert identifies the exact execution that failed.FAILED and WARNING) only.Gmail has no awareness of your pipelines and cannot tell you when a job fails. Kestra closes that gap. The event-driven Flow trigger reacts the instant an execution changes status, condition filtering keeps noise low, retries and full execution lineage are captured automatically, and the entire alerting policy lives in one declarative YAML file you can version and reuse rather than copy-pasting error handlers into every workflow.
G_EMAIL: the Gmail address used to authenticate against the SMTP server.G_APP_PASSWORD: the Gmail App password used as the SMTP password.G_EMAIL and G_APP_PASSWORD secrets to your Kestra instance.from, to, host, and port in the notify task to match your sender and recipients.ExecutionNamespaceCondition to the trigger (see the monitoring guide).htmlTextContent with the flow id, namespace, start date, and a direct link to the execution.