Gmail icon

Gmail

Send emails via the Gmail API

Actions3

Draft → Create

AI-generated

Summary

Creates a Gmail draft for each input item by building a MIME message from the subject, body, and optional recipients, attachments, and sender settings, then POSTing it to the Gmail drafts API. It does not send the draft.

Inputs

  • Subject (required) — Subject line of the draft.
  • Email Type (required) — Text or HTML. Decides whether Message is set as the plain-text body or the HTML body. Default is Text.
  • Message (required) — Body content of the draft. It is trimmed before use.
  • Options > To Email — Comma-separated recipient addresses. Each entry must contain '@' or the item errors. The field is optional, so a draft can be created with no recipient.
  • Options > CC — Comma-separated CC addresses, validated the same way as To.
  • Options > BCC — Comma-separated BCC addresses. BCC is kept in the draft message.
  • Options > Send Replies To — Reply-To address, validated like the other address fields.
  • Options > From Alias Name or ID — A Gmail send-as alias, loaded from the account's sendAs settings, to use as the From address.
  • Options > Sender Name — Display name for the From header. The node calls the Gmail profile endpoint to get the account address, unless an alias is set, and formats From as 'Name
    '.
  • Options > Thread ID — Gmail thread ID to attach the draft to.
  • Options > Attachments — One or more entries, each naming binary field(s) on the input item. Separate several field names with commas. A missing binary field raises an error. The filename and MIME type are taken from the binary data.

Output shape

One output item per input item, containing the Gmail API response for the created draft (typically the draft id and a message object with id and threadId).

Items are paired to their input items. If 'Continue On Fail' is on, a failed item returns {error: message (item N)} instead of stopping the run. Requires the gmailOAuth2 credential.

Examples

Example 1: Draft a reply for review inside an existing conversation

Subject 'Re: Order 1234', Email Type Text, Message from an expression, Options: To Email set to the customer, Thread ID set to the original thread ID.

Example 2: Create an HTML report draft with an attached file

Email Type HTML, Message with HTML markup, Options: To Email, CC, Attachments with field name 'data' from a previous node.

Example 3: Prepare a draft from a shared alias with a custom sender name

Options: From Alias set to support@example.com, Sender Name 'Support Team', Send Replies To set to help@example.com.

Links

Discussion