Send an email via Gmail
Send an email message using Gmail API with support for text/HTML content and attachments
type: "io.kestra.plugin.googleworkspace.mail.Send"Examples
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:
- [email protected]
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:
- [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
clientId *Requiredstring
OAuth 2.0 Client ID
The OAuth 2.0 client ID from Google Cloud Console
clientSecret *Requiredstring
OAuth 2.0 Client Secret
The OAuth 2.0 client secret from Google Cloud Console
refreshToken *Requiredstring
OAuth 2.0 Refresh Token
The OAuth 2.0 refresh token obtained through the authorization flow
to *Requiredarray
Recipient email addresses (To field)
List of primary recipient email addresses
accessToken string
OAuth 2.0 Access Token
The OAuth 2.0 access token (optional, will be generated from refresh token if not provided)
attachments array
File attachments
List of file URIs to attach to the email
bcc array
BCC recipient email addresses
List of BCC recipient email addresses
cc array
CC recipient email addresses
List of CC recipient email addresses
from string
From email address
Sender email address (defaults to authenticated user)
htmlBody string
HTML body
HTML content of the email
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
Email subject
Subject line for the email
textBody string
Plain text body
Plain text content of the email
Outputs
messageId string
The ID of the sent message
threadId string
The thread ID of the sent message