mail>: Sending email

mail> operator sends an email.

To use Gmail SMTP server, you need to do either of:

  • a) Generate a new app password at App passwords . This needs to enable 2-Step Verification first.
  • b) Enable access for less secure apps at Less secure apps . This works even if 2-Step Verification is not enabled.
Copy
Copied
_export:
  mail:
    from: "you@gmail.com"

+step1:
  mail>: body.txt
  subject: workflow started
  to: [me@example.com]
  cc: [foo@example.com,bar@example.com]

+step2:
  mail>:
    data: this is email body embedded in a .dig file
  subject: workflow started
  to: [me@example.com]
  bcc: [foo@example.com,bar@example.com]

+step3:
  py>: tasks.MyWorkflow.this_task_might_fail
  _error:
    mail>: body.txt
    subject: this workflow failed
    to: [me@example.com]

Secrets

When you don't know how to set secrets, please refer to Managing Workflow Secret

  • mail.host : HOST

    SMTP host name.

    Examples:

    Copy
    Copied
    mail.host: smtp.gmail.com
  • mail.port : PORT

    SMTP port number.

    Examples:

    Copy
    Copied
    mail.port: 587
  • mail.username : NAME

    SMTP login username.

    Examples:

    Copy
    Copied
    mail.username: me
  • mail.password : PASSWORD

    SMTP login password.

    Examples:

    Copy
    Copied
    mail.password: MyPaSsWoRd

    If you encountered Unsecure 'password' parameter is deprecated. message, please confirm you used the following command.

    Copy
    Copied
    # Server Mode
    digdag secret --project test_mail --set mail.password=xxxxx
    
    # Local Mode stores the parameter into `~/.config/digdag/secrets/mail.password`
    digdag secret --local --set mail.password=xxxxx
  • mail.tls : BOOLEAN Enables TLS handshake.

    Examples:

    Copy
    Copied
    mail.tls: true
  • mail.ssl : BOOLEAN

    Enables legacy SSL encryption.

    Examples:

    Copy
    Copied
    mail.ssl: false

Options

  • mail> : FILE

    Path to a mail body template file. This file can contain ${...} syntax to embed variables. Alternatively, you can set {data: TEXT} to embed body text in the .dig file.

    Examples:

    Copy
    Copied
    mail>: mail_body.txt
    • or :command: mail>: {data: "Hello, this is from Digdag"}
  • subject : SUBJECT

    Subject of the email.

    Examples:

    Copy
    Copied
    subject: Mail From Digdag
  • to : [ADDR1, ADDR2, ...]

    To addresses.

    Examples:

    Copy
    Copied
    to: [analyst@example.com]
  • cc : [ADDR1, ADDR2, ...]

    Cc addresses.

    Examples:

    Copy
    Copied
    cc: [analyst@example.com]
  • bcc : [ADDR1, ADDR2, ...]

    Bcc addresses.

    Examples:

    Copy
    Copied
    bcc: [analyst@example.com]
  • from : ADDR From address.

    Examples:

    Copy
    Copied
    from: admin@example.com
  • host : NAME

    SMTP host name.

    Examples:

    Copy
    Copied
    host: smtp.gmail.com
  • port : NAME

    SMTP port number.

    Examples:

    Copy
    Copied
    port: 587
  • username : NAME

    SMTP login username.

    Examples:

    Copy
    Copied
    username: me
  • tls : BOOLEAN

    Enables TLS handshake.

    Examples:

    Copy
    Copied
    tls: true
  • ssl : BOOLEAN

    Enables legacy SSL encryption.

    Examples:

    Copy
    Copied
    ssl: false
  • html : BOOLEAN

    Uses HTML mail (default: false).

    Examples:

    Copy
    Copied
    html: true
  • debug : BOOLEAN

    Shows debug logs (default: false).

    Examples:

    Copy
    Copied
    debug: false
  • attach_files : ARRAY

    Attach files. Each element is an object of:

    • path: FILE : Path to a file to attach.
    • content_type: STRING : Content-Type of this file. Default is application/octet-stream.
    • filename: NAME : Name of this file. Default is base name of the path.

    Example:

    attachfiles: - path: data.csv - path: output.dat filename: workflowresultdata.csv - path: images/image1.png contenttype: image/png