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

# Create email

> Create, send, schedule, or log a Close email.

`close.createEmail` create, send, schedule, or log a Close email.

```ts automations/close-create-email.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { close } from "automate.ax/close"

export default automation("Create email", () => {
  onDashboardRun({ title: "Create email" })
  close.createEmail({
    leadId: "lead_abc123",
    status: "outbox",
    sender: "Ada <ada@example.com>",
    to: ["buyer@example.com"],
    subject: "Next steps",
    bodyText: "Here are the next steps.",
  })
})
```

## Inputs

Provide `leadId` and `status`: `draft`, `scheduled`, `outbox`, `sent`, `inbox`, or `error`. Scheduled email requires `dateScheduled`; inbox, scheduled, outbox, and error require `sender`. `sendIn` accepts 0–59 seconds. You may include recipients, content, template, reply, follow-up, user, account, and uploaded Close attachments. Optional second argument `{ account }` selects a named Close binding.

## Output

Returns the created `CloseEmail`. `outbox` sends, `scheduled` queues, `draft` saves, and `sent` or `inbox` logs an external message.
