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

# email

> Send transactional email from the terminal: single send and batch.

`jetemail email` wraps the transactional send endpoints. Two subcommands:

| Subcommand    | Endpoint            | Description                          |
| ------------- | ------------------- | ------------------------------------ |
| `email send`  | `POST /email`       | Send a single message                |
| `email batch` | `POST /email-batch` | Send up to N messages in one request |

`jetemail send …` is a shorthand alias for `jetemail email send …`.

Authentication uses your **transactional** key (`transactional_…`). Set it with `jetemail login`, `JETEMAIL_TRANSACTIONAL_KEY`, or `--transactional-key`.

## `email send`

```sh theme={null}
jetemail email send \
  --from 'noreply@example.com' \
  --to alice@example.org --to bob@example.org \
  --subject 'Welcome' \
  --html @welcome.html \
  --attach ./invoice.pdf \
  --idempotency-key "$(uuidgen)"
```

If `--from`, `--to`, or `--subject` aren't supplied in an interactive shell, you'll be prompted for the missing values. The body (`--html` / `--text`) is required for an actual send.

### Flags

| Flag                       | Description                                                                                                               |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `--from <addr>`            | Sender address (e.g. `name@yourdomain.com`).                                                                              |
| `--to <addr>`              | Recipient address. Repeat for multiple.                                                                                   |
| `--subject <str>`          | Subject line.                                                                                                             |
| `--html <src>`             | HTML body. Literal string, `@file`, or `-` for stdin.                                                                     |
| `--text <src>`             | Plain-text body. Literal string, `@file`, or `-`.                                                                         |
| `--cc <addr>`              | CC address. Repeatable.                                                                                                   |
| `--bcc <addr>`             | BCC address. Repeatable.                                                                                                  |
| `--reply-to <addr>`        | Reply-To address.                                                                                                         |
| `--header 'Name: Value'`   | Custom header. Repeatable.                                                                                                |
| `--attach <spec>`          | Attachment. `@path/to/file` (auto-base64) or a JSON object literal. Repeatable.                                           |
| `--eu`                     | Route through the EU region.                                                                                              |
| `--scheduled-at <iso8601>` | Schedule the send. See [Scheduled email](/transactional-email/scheduled-email).                                           |
| `--idempotency-key <key>`  | Idempotency-Key header. Same key replays the original response. See [Idempotency](/transactional-email/idempotency-keys). |
| `--body-json <src>`        | Whole body. Merged underneath typed flags. See [Body & field escape hatches](/cli/body-json).                             |
| `--field key=value`        | Override a single top-level field. Repeatable.                                                                            |

### Body sources

`--html`, `--text`, and `--body-json` all accept the same three sources:

| Source  | Meaning                                                         |
| ------- | --------------------------------------------------------------- |
| Literal | `--html "<p>Hi</p>"`                                            |
| `@path` | Read from a file: `--html @welcome.html`                        |
| `-`     | Read from stdin: `cat welcome.html \| jetemail send … --html -` |

### Attachments

```sh theme={null}
# From a path (auto-encoded base64, content-type inferred)
jetemail send … --attach ./invoice.pdf

# Multiple
jetemail send … --attach ./a.pdf --attach ./b.png

# Full control via a JSON object literal
jetemail send … --attach '{"filename":"data.json","contentType":"application/json","content":"eyJrIjoidiJ9"}'
```

### Examples

**Plain text:**

```sh theme={null}
jetemail send \
  --from no-reply@example.com \
  --to alice@example.org \
  --subject "Receipt #1234" \
  --text "Thanks for your order."
```

**HTML from a template file with overrides:**

```sh theme={null}
jetemail send \
  --body-json @welcome-template.json \
  --to alice@example.org \
  --subject "Welcome, Alice"
```

**Scheduled, EU-routed, idempotent:**

```sh theme={null}
jetemail send \
  --from billing@example.com \
  --to customer@example.org \
  --subject "Your monthly invoice" \
  --html @invoice.html \
  --attach ./invoice-2026-04.pdf \
  --eu \
  --scheduled-at 2026-05-15T09:00:00Z \
  --idempotency-key "invoice-2026-04-customer-42"
```

## `email batch`

Send many messages in one request. Pass a JSON document containing either the full batch payload or just the array of email objects.

```sh theme={null}
# Either shape works:
echo '[{"to":"a@x.com","from":"n@y.com","subject":"hi","text":"hi"}, …]' \
  | jetemail email batch --body-json -

jetemail email batch --body-json @batch.json
```

`batch.json` can be:

```json theme={null}
{ "emails": [ { "to": "a@x.com", … }, { "to": "b@x.com", … } ] }
```

or the array form:

```json theme={null}
[ { "to": "a@x.com", … }, { "to": "b@x.com", … } ]
```

A single-object body is treated as a batch of one.

### Flags

| Flag                      | Description                                            |
| ------------------------- | ------------------------------------------------------ |
| `--body-json <src>`       | **Required.** JSON payload (`@file`, `-`, or literal). |
| `--idempotency-key <key>` | Replay the response if the same key is used again.     |

## Related

* [Transactional getting started](/transactional-email/getting-started)
* [Idempotency keys](/transactional-email/idempotency-keys)
* [Scheduled email](/transactional-email/scheduled-email)
* [Body & field escape hatches](/cli/body-json)
