Skip to Content

Send Email

Sends an email using Gmail on behalf of the authenticated user. This action allows you to programmatically send emails with custom headers, subject, and body content.

Overview

  • Purpose: Send emails programmatically through Gmail API.
  • Use Cases: Automated email notifications, transactional emails, workflow-triggered communications, customer outreach, internal notifications.
  • API Method: POST /emails
  • Gmail API: Uses Gmail API v3 /gmail/v1/users/me/messages/send endpoint.
  • Required Scope: https://www.googleapis.com/auth/gmail.send

Required Input Fields

From: Sender’s email address. Must be the authenticated user’s email or an alias/send-as address configured in Gmail.

To: Recipient’s email address. Can be a single email address.

Subject: Email subject line.

Body: Email body content in plain text format.

Optional Input Fields

Headers: Object containing custom email headers as key-value pairs. Common headers include ‘Cc’, ‘Bcc’, ‘Reply-To’, ‘Content-Type’, etc.

Email Headers

  • Cc: Carbon copy recipients (e.g., {‘Cc’: ‘user@example.com’}).
  • Bcc: Blind carbon copy recipients (e.g., {‘Bcc’: ‘hidden@example.com’}).
  • Reply-To: Email address for replies (e.g., {‘Reply-To’: ‘support@example.com’}).
  • Content-Type: Specify email format (e.g., {‘Content-Type’: ‘text/html; charset=UTF-8’} for HTML emails).
  • Custom Headers: Any valid email header can be included (e.g., {‘X-Priority’: ‘1’} for high priority).

Output

  • Message ID: Unique identifier for the sent email message in Gmail.
  • Thread ID: Unique identifier for the email thread. If this is a new conversation, a new thread ID is created. If replying, it would match the original thread.

Email Format

  • Plain Text: By default, emails are sent as plain text.
  • HTML Emails: To send HTML emails, include ‘Content-Type’: ‘text/html; charset=UTF-8’ in the headers object.
  • Encoding: The action automatically base64-encodes the email content as required by Gmail API.
  • RFC 2822: Email is formatted according to RFC 2822 standard before sending.

Sender Requirements

[!IMPORTANT] Authenticated User: The ‘from’ address must be the authenticated user’s email or an authorized alias.

  • Send-As Addresses: If using an alias, it must be configured in Gmail settings as a ‘send-as’ address.
  • Verification: Gmail may reject emails if the ‘from’ address is not verified.
  • Domain Restrictions: Some organizations may restrict sending from certain domains.

Required Permissions

[!IMPORTANT] OAuth Scope: Requires https://www.googleapis.com/auth/gmail.send scope.

  • User Consent: Users must grant permission to send emails during OAuth flow.
  • Send-Only: This scope only allows sending emails, not reading or modifying existing emails.

Rate Limits

[!WARNING] Gmail Limits: Gmail has sending limits (typically 500 emails/day for free accounts, 2000/day for Google Workspace).

  • Retry Logic: The action automatically retries failed requests up to 3 times.
  • Throttling: Consider implementing delays between bulk sends to avoid hitting rate limits.

Tips

[!TIP] Ensure the ‘from’ address matches the authenticated user’s email or a verified alias

[!TIP] Use headers object to add Cc and Bcc recipients instead of including them in ‘to’ field

[!TIP] For HTML emails, set Content-Type header to ‘text/html; charset=UTF-8’

[!TIP] Store the returned message ID for tracking and reference purposes

[!TIP] Thread ID can be used to track conversation threads and replies

[!TIP] Test with your own email first before sending to external recipients

[!WARNING] Be aware of Gmail’s daily sending limits to avoid quota errors

[!TIP] Use Reply-To header if you want replies to go to a different address

[!TIP] Consider implementing error handling for quota exceeded errors

[!TIP] For bulk sending, implement delays and batch processing to respect rate limits

[!TIP] Validate email addresses before sending to avoid delivery failures

[!TIP] The action uses plain text by default - explicitly set Content-Type for HTML

Need help? Have feedback?