Skip to main content
gmail.sendEmail sends a message to known recipients. It can start a conversation or add a follow-up to an existing thread, including when nobody has replied yet.

Example

automations/send-report.automation.ts
Provide at least one of text, markdown, or html. Automate.ax preserves supplied plain-text and HTML bodies. Markdown generates either missing alternative. Otherwise, HTML generates plain text, and plain text generates HTML.

Inputs

Recipient is an email string or { address: string; name?: string }. Attachment is a File or an object containing file with optional filename, contentId, and disposition: "attachment" | "inline". Inputs accept compatible signals.
Gmail may reject or replace a from address that is not configured as a send-as alias on the connected account.
The message carries an authenticated automation origin. Gmail triggers don’t wake the automation that sent it, while other automations watching the mailbox still receive the event.

Output

Returns Signal<MessageMetadata>: Keep messageId for actions that operate on one message and threadId for actions that operate on the conversation. For a follow-up, read the conversation with gmail.getThread. Pass its threadId, preserve the subject, and set headers["In-Reply-To"] to the preceding message’s rfc822MessageId. Set headers.References to that message’s references followed by its rfc822MessageId, joined with spaces. Keep to set to your intended recipients. These are Gmail’s threading requirements.