# CLI (/docs/reference/cli)



The CLI is intentionally small. Use it to inspect adapters, check environment variables, validate a message with `--dry-run`, and send a smoke-test email from your terminal.

```bash
email-sdk send \
  --adapter resend \
  --from "Acme <hello@acme.com>" \
  --to "user@example.com" \
  --subject "Hello" \
  --text "It works"
```

## Adapters [#adapters]

```bash
email-sdk adapters
```

| Adapter      | Required environment                              |
| ------------ | ------------------------------------------------- |
| `resend`     | `RESEND_API_KEY`                                  |
| `postmark`   | `POSTMARK_SERVER_TOKEN`                           |
| `sendgrid`   | `SENDGRID_API_KEY`                                |
| `mailgun`    | `MAILGUN_API_KEY`, `MAILGUN_DOMAIN`               |
| `mailersend` | `MAILERSEND_API_KEY`                              |
| `brevo`      | `BREVO_API_KEY`                                   |
| `mailchimp`  | `MAILCHIMP_API_KEY`                               |
| `sparkpost`  | `SPARKPOST_API_KEY`                               |
| `loops`      | `LOOPS_API_KEY`, `LOOPS_TRANSACTIONAL_ID`         |
| `plunk`      | `PLUNK_API_KEY`                                   |
| `mailtrap`   | `MAILTRAP_API_KEY`                                |
| `scaleway`   | `SCALEWAY_SECRET_KEY`, `SCALEWAY_PROJECT_ID`      |
| `zeptomail`  | `ZEPTOMAIL_TOKEN`                                 |
| `mailpace`   | `MAILPACE_API_KEY`                                |
| `smtp`       | `SMTP_HOST`, plus SMTP auth variables when needed |

If `--adapter` is omitted, the CLI selects the first adapter with all required environment variables set.

## Doctor [#doctor]

```bash
email-sdk doctor --adapter resend
```

`doctor` checks whether the selected adapter has the required environment variables.

## Flags [#flags]

| Flag                    | Adapter   | Notes                                                  |
| ----------------------- | --------- | ------------------------------------------------------ |
| `--adapter`             | all       | Adapter routing name.                                  |
| `--provider`            | all       | Alias for `--adapter`.                                 |
| `--from`                | all       | Sender address.                                        |
| `--to`                  | all       | Recipient address. Comma-separated values are allowed. |
| `--subject`             | all       | Message subject.                                       |
| `--text`                | all       | Plain text body.                                       |
| `--html`                | all       | HTML body.                                             |
| `--cc`                  | send      | Comma-separated CC addresses.                          |
| `--bcc`                 | send      | Comma-separated BCC addresses.                         |
| `--reply-to`            | send      | Comma-separated reply-to addresses.                    |
| `--header`              | send      | Header in `Name: value` format. Repeatable.            |
| `--tag`                 | send      | Tag in `name=value` format. Repeatable.                |
| `--metadata`            | send      | Metadata in `key=value` format. Repeatable.            |
| `--attachment`          | send      | Local file path, optionally `path:content/type`.       |
| `--message`             | send      | Read an `EmailMessage` JSON payload from a file.       |
| `--dry-run`             | all       | Validate and print the send plan without sending.      |
| `--api-key`             | many      | Overrides the adapter API key variable.                |
| `--server-token`        | Postmark  | Overrides `POSTMARK_SERVER_TOKEN`.                     |
| `--message-stream`      | Postmark  | Optional message stream.                               |
| `--domain`              | Mailgun   | Overrides `MAILGUN_DOMAIN`.                            |
| `--transactional-id`    | Loops     | Overrides `LOOPS_TRANSACTIONAL_ID`.                    |
| `--project-id`          | Scaleway  | Overrides `SCALEWAY_PROJECT_ID`.                       |
| `--secret-key`          | Scaleway  | Overrides `SCALEWAY_SECRET_KEY`.                       |
| `--token`               | ZeptoMail | Overrides `ZEPTOMAIL_TOKEN`.                           |
| `--host`                | SMTP      | Overrides `SMTP_HOST`.                                 |
| `--port`                | SMTP      | Overrides `SMTP_PORT`.                                 |
| `--secure`              | SMTP      | Set to `true` for secure SMTP.                         |
| `--require-tls`         | SMTP      | Require STARTTLS.                                      |
| `--allow-insecure-auth` | SMTP      | Allow SMTP AUTH without TLS.                           |
| `--user`                | SMTP      | Overrides `SMTP_USER`.                                 |
| `--pass`                | SMTP      | Overrides `SMTP_PASS`.                                 |

The CLI prints the normalized adapter response as JSON.
