Send an email via Gmail

Send an email message using Gmail API with support for text/HTML content and attachments

yaml
type: "io.kestra.plugin.googleworkspace.mail.Send"

Send a simple text email

yaml
id: send_simple_email
namespace: company.team

tasks:
  - id: send_email
    type: io.kestra.plugin.googleworkspace.mail.Send
    clientId: "{{ secret('GMAIL_CLIENT_ID') }}"
    clientSecret: "{{ secret('GMAIL_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('GMAIL_REFRESH_TOKEN') }}"
    to:
      - [email protected]
    subject: Test Email
    textBody: This is a test email from Kestra

Send an HTML email with CC and attachments

yaml
id: send_rich_email
namespace: company.team

tasks:
  - id: send_rich_email
    type: io.kestra.plugin.googleworkspace.mail.Send
    clientId: "{{ secret('GMAIL_CLIENT_ID') }}"
    clientSecret: "{{ secret('GMAIL_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('GMAIL_REFRESH_TOKEN') }}"
    to:
      - [email protected]
    cc:
      - [email protected]
      - [email protected]
    subject: Rich Email
    htmlBody: "<h1>Hello</h1><p>This is a <b>rich</b> email!</p>"
    attachments:
      - /path/to/file.pdf
      - /path/to/image.png
Properties

OAuth 2.0 Client ID

The OAuth 2.0 client ID from Google Cloud Console

OAuth 2.0 Client Secret

The OAuth 2.0 client secret from Google Cloud Console

OAuth 2.0 Refresh Token

The OAuth 2.0 refresh token obtained through the authorization flow

SubType string

Recipient email addresses (To field)

List of primary recipient email addresses

OAuth 2.0 Access Token

The OAuth 2.0 access token (optional, will be generated from refresh token if not provided)

SubType string

File attachments

List of file URIs to attach to the email

SubType string

BCC recipient email addresses

List of BCC recipient email addresses

SubType string

CC recipient email addresses

List of CC recipient email addresses

From email address

Sender email address (defaults to authenticated user)

HTML body

HTML content of the email

Default 120

The read timeout for the request (in seconds)

SubType string
Default ["https://www.googleapis.com/auth/gmail.modify","https://www.googleapis.com/auth/gmail.readonly","https://www.googleapis.com/auth/gmail.send"]

The OAuth scopes to use

List of OAuth 2.0 scopes required for the operation

Email subject

Subject line for the email

Plain text body

Plain text content of the email

The ID of the sent message

The thread ID of the sent message