> ## 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.

# On email sent

> Start an automation when a person sends a message from Gmail.

`onGmailEmailSent` subscribes an automation to messages sent from the connected Gmail mailbox. Use it to record outbound conversations or continue work after a person sends a message.

The trigger emits the same fully parsed message shape as [Get message](/reference/integrations/gmail/actions/get-message), including headers, MIME bodies, labels, and attachment `File` objects.

## Example

```ts automations/track-sent-email.automation.ts theme={null}
import { automation } from "automate.ax"
import { onGmailEmailSent } from "automate.ax/gmail"

export default automation("Track sent Gmail messages", () => {
  const message = onGmailEmailSent()

  message.transform(({ messageId, subject, to }) => ({
    messageId,
    subject,
    recipients: to.map(({ address }) => address),
  }))
})
```

## Options

| Property  | Type                                              | Required | Description                                                                                       |
| --------- | ------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------- |
| `account` | `string \| IntegrationAccountReference<"google">` | No       | Static Google account binding to watch. Defaults to the project's default Google account binding. |

You can call `onGmailEmailSent()` without an options object. The account selection must be static: a `Signal` cannot choose which mailbox to watch at runtime.

## Trigger data

Returns a `Signal<Message>` for each qualifying message. See [Get message](/reference/integrations/gmail/actions/get-message#output) for the complete `Message` shape.

## Behavior

* Only messages newly added to Gmail's `SENT` collection qualify. Existing sent messages are not replayed when you deploy the trigger.
* The parsed `from.address` must match the watched mailbox. A different send-as alias does not qualify.
* Messages carrying Automate.ax's outbound marker are excluded to prevent recursive automation loops.
* Gmail message IDs provide idempotency, so repeated notifications for the same sent message do not create duplicate events.
