> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Send a draft

> Send an existing Gmail draft by its draft ID.

`sendDraft` sends a message already saved in Gmail. Use it after `draftEmail`,
`draftReply`, or a human review step has produced a ready-to-send draft.

## Example

```ts automations/send-approved-draft.automation.ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { sendDraft } from "automate.ax/gmail"

export default automation("Send an approved Gmail draft", () => {
  onHttpRequest({ scope: "automation" })

  sendDraft({
    draftId: "r1234567890",
  })
})
```

## Inputs

| Input     | Type                                              | Required | Default         | Description                                   |
| --------- | ------------------------------------------------- | -------- | --------------- | --------------------------------------------- |
| `draftId` | `string`                                          | Yes      | —               | Immutable Gmail draft ID to send.             |
| `account` | `string \| IntegrationAccountReference<"google">` | No       | Project default | Connected Google account that owns the draft. |

Every input, including `account`, also accepts a compatible `Signal`.

Pass the `draftId` returned by `draftEmail`, `draftReply`, `getDraft`,
`searchDrafts`, or `updateDraft`. A draft's `messageId` is not accepted here.
After Gmail sends the draft, that draft no longer exists as an editable draft.

## Output

Returns a `Signal<MessageMetadata>` with:

| Property    | Type                  | Description                                                              |
| ----------- | --------------------- | ------------------------------------------------------------------------ |
| `messageId` | `string`              | Immutable Gmail ID of the sent message.                                  |
| `threadId`  | `string`              | Gmail thread containing the sent message.                                |
| `historyId` | `string \| undefined` | Latest mailbox history record affecting the sent message, when supplied. |
| `labelIds`  | `string[]`            | Labels applied to the sent message.                                      |

The output describes the sent message, not the now-consumed draft.
