# SMTP Send Task

This task sends an email.

# Example Usage

# File: examples/smtp_send_example.hcl

flow "smtp_send_example" {

  variable "smtp_username" {}

  variable "smtp_password" {}

  task "smtp_send" "gmail" {
    email_from = "alice@example.org"
    email_to = "bob@example.org"
    email_to_cc = "charlie@example.org"
    email_to_bcc = "david@example.org"

    subject = "Sent from Runflow smtp_send task"
    message = "Hello, this mail is sent from Runflow smtp_send task"
    html_message = <<-EOT
      <h1>HTML Message</h1>
      <p>Hello, this mail is sent from Runflow smtp_send task</p>
    EOT

    client = {
      host = "smtp.gmail.com"
      port = 465
      username = var.smtp_username
      password = var.smtp_password
      timeout = 30
    }
  }
}

# Argument Reference

  • subject - (Required, str) The subject of email.
  • message - (Optional, str) The content of email in plain text. Can be used with html_message.
  • html_message - (Optional, str) The content of email in HTML. Can be used with message.
  • email_from - (Required, str) The email sender's address.
  • email_to - (Required, str) The email receiver's address.
  • email_to_cc - (Optional, str) CC address.
  • email_to_bcc - (Optional, str) BCC address.
  • attachments - (Optional, List[str]) A list of paths to attachment files.
  • client - (Required, map) The SMTP client.
    • host - (Required, str) The SMTP server address.
    • port - (Required, int) The SMTP server port.
    • username - (Required, str) The login username.
    • password - (Required, str) The login password.
    • local_hostname - (Optional, str) If specified, local_hostname is used as the FQDN of the local host in the HELO/EHLO command.
    • timeout - (Optional, int) The timeout in seconds.
    • source_address - (Optional, str) Allows binding to some specific source address in a machine with multiple network interfaces.