
Google Mail Send
CertifiedSend an email with Gmail API
Google Mail Send
Send an email with Gmail API
Sends a message using OAuth Gmail access. Supports text/HTML bodies, CC/BCC, and attachments from kestra:// URIs.
type: io.kestra.plugin.googleworkspace.mail.SendExamples
Send a simple text email
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:
- recipient@example.com
subject: Test Email
textBody: This is a test email from Kestra
Send an HTML email with CC and attachments
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:
- recipient@example.com
cc:
- cc1@example.com
- cc2@example.com
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
Installation
Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:
kestractl plugins get io.kestra.plugin:plugin-googleworkspace --compatible-for $KESTRA_VERSION For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.
For Kestra CLI, replace LATEST with a specific version or version range to pin the plugin version.
Properties
clientId *string
OAuth client ID
Google OAuth 2.0 client ID for the Gmail project
clientSecret *string
OAuth client secret
Google OAuth 2.0 client secret
refreshToken *string
OAuth refresh token
Refresh token obtained via OAuth consent; used to mint access tokens
to *array
To recipients
Primary recipient email addresses
accessToken string
OAuth access token
Optional access token; if absent, one is fetched from the refresh token
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150attachments array
Attachments
List of kestra:// file URIs to attach
bcc array
BCC recipients
Blind carbon copy addresses
cc array
CC recipients
Carbon copy addresses
from string
From address
Sender email; defaults to authenticated Gmail user
htmlBody string
HTML body
HTML content
readTimeout integerstring
120The read timeout for the request (in seconds)
scopes array
["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
subject string
Subject
Subject line
textBody string
Plain text body
Plain text content
Outputs
messageId string
Sent message ID
threadId string
Thread ID of sent message