MailExecution MailExecution

type: "io.kestra.plugin.notifications.mail.MailExecution"

Task to send a mail with execution information

Main execution information are provided in the sent mail (id, namespace, flow, state, duration, start date ...).

# Examples

Send a mail notification on failed flow

id: mail
namespace: io.kestra.tests

listeners:
  - conditions:
      - type: io.kestra.core.models.conditions.types.ExecutionStatusCondition
        in:
          - FAILED
    tasks:
      - id: mail
        type: io.kestra.plugin.notifications.mail.MailExecution
        to: to@mail.com
        from: from@mail.com
        subject: This is the subject
        host: nohost-mail.site
        port: 465
        username: user
        password: pass
        sessionTimeout: 1000
        transportStrategy: SMTPS

tasks:
  - id: ok
    type: io.kestra.core.tasks.debugs.Return
    format: "{{task.id}} > {{taskrun.startDate}}"

# Properties

# attachments

  • Type: array
  • SubType: Attachment
  • Dynamic: ✔️
  • Required:

Adds an attachment to the email message

which will be shown in the email client as separate files available for download or inline display if the client supports it (for example, most browsers these days display PDF's in a popup).

# 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 an RFC2822 format compliant address.

# 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: Attachment
  • Dynamic: ✔️
  • Required:

Adds image data to this email that can be referred to from the email HTML body.

The provided images is assumed to be of mimetype png, jpg or whatever the email client supports as valid image embedded in HTML content.

# executionId

  • Type: string
  • Dynamic: ✔️
  • Required:
  • Default: {{ execution.id }}

The execution id to use

Default is the current execution

# from

  • Type: string
  • Dynamic: ✔️
  • Required:

The address of the sender of this email

# host

  • Type: string
  • Dynamic: ✔️
  • Required:

The mail 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 content. Email clients that support it, will favor HTML over plain text and ignore the text body completely

# password

  • Type: string
  • Dynamic: ✔️
  • Required:

The mail server password

# port

  • Type: integer
  • Dynamic: ✔️
  • Required:

The mail server port

# sessionTimeout

  • Type: integer
  • Dynamic:
  • Required:
  • Default: 1000

Controls the timeout to use when sending emails

It affects socket connect-, read- and write timeouts

# subject

  • Type: string
  • Dynamic: ✔️
  • Required:

The optional subject of this email

# templateRenderMap

  • Type: object
  • Dynamic: ✔️
  • Required:

Render map to use for template

# templateUri

  • Type: string
  • Dynamic: ✔️
  • Required:

Template to use

# to

  • Type: string
  • Dynamic: ✔️
  • Required:

One or more recipient email address. Use semicolon as delimiter to provide several addresses

Note that each email address must be an RFC2822 format compliant address

# 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 mail server username

# Definitions

# Attachment

# contentType

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️
  • Default: application/octet-stream

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 an RFC2822 format compliant address.

# name

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

name of the attachment (eg. 'filename.ext').

# uri

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

An attachment uri from kestra internal storage