Add email to your app with one prompt

Paste one prompt into Claude Code, Cursor, Codex or any coding agent that can run shell commands. The agent signs you in (or up), sends a test email to you, verifies your sending domain, creates a send-only key for your app and wires your first real email, such as a password reset or a receipt.

No API key to copy: the agent signs in through your browser. It asks you before it emails anyone but you, changes DNS or touches billing.

Related: Agent Skills · MCP server · Test sends and idempotency · Quickstart


The prompt

Copy this into your agent from the root of your project:

Set up Groundmail (transactional email) in this project. Do the work yourself.
Ask me before anything that emails anyone except me, changes DNS, or touches billing.

## 1. Install and sign in
```bash
npm install -g groundmail-cli   # or put `npx -y groundmail-cli` in place of `groundmail` below
groundmail login
```
`login` opens my browser: tell me to sign up if I don't have an account yet, then click Approve. Then run `groundmail whoami`: it shows my account email, used below.
No API key is needed for this: the sign-in covers every `groundmail` command. (In CI, `GROUNDMAIL_API_KEY` is used instead.)

## 2. Prove it works (sandbox, no domain needed)
```bash
groundmail emails send --from noreply@mail.groundmail.dev --to <my account email> \
  --subject "Groundmail works" --html "<p>It works.</p>"
```
You get an id like `msg_…`; confirm delivery with `groundmail emails get --id <id>`.

## 3. Sending domain (ask me which domain first)
```bash
groundmail domains add <domain>
groundmail domains apply <domain> --provider cloudflare   # or vercel / godaddy
groundmail domains verify <domain>
```
If my DNS is somewhere else, show me the records from `groundmail domains get <domain>` to add. DNS can take a few minutes; re-run verify until it says verified.

## 4. Wire it into the app
- Make a send-only key for the app:
  `groundmail keys create --name "<app> production" --scopes emails:send`
- Save it as `GROUNDMAIL_API_KEY` wherever this project keeps secrets. Server-side only; never commit it or expose it to the browser.
- Install the SDK (`npm install groundmail`; Python, PHP, Ruby and Go SDKs exist too) and add one send helper that follows this project’s patterns. The API base URL is https://api.groundmail.dev.
- Use it for the first real flow I name (password reset, receipt, …).
- Give every send an `Idempotency-Key` header (SDK option `idempotencyKey`) unique to the message, and reuse it on retries.
- On an error, branch on `error.code` and follow `error.hint`. Retry only 429, 500, 502 and 503, with backoff and the same Idempotency-Key.
- Prefer the canonical field names (`html`, `text`, `reply_to`).

## 5. Before real traffic
The free plan only sends to my account email until a domain is verified and a payment method is on file (no charge until an upgrade). If I need to add one, send me to https://app.groundmail.dev/settings/billing.

## Done when
- The test email arrived at my account email.
- The domain is verified.
- One real flow in the app sends through Groundmail.

## Reference
- Optional Agent Skills: `npx skills add Groundmail/groundmail-skills --skill groundmail -y` (https://docs.groundmail.dev/ai/agent-skills)
- Agent notes: https://docs.groundmail.dev/ai/agent-skill
- Quickstart: https://docs.groundmail.dev/quickstart
- Errors: https://docs.groundmail.dev/errors
- llms.txt: https://docs.groundmail.dev/llms.txt
- OpenAPI: https://docs.groundmail.dev/openapi.yaml
- Dashboard: https://app.groundmail.dev

Signed in already? The Copy agent prompt button on your dashboard Home page gives you the same prompt with your account email filled in.


What you need

  • A domain you control, and access to its DNS. With Cloudflare, Vercel or GoDaddy the agent can add the records for you; anywhere else it shows you the records to add.
  • A payment method on file before you email anyone except yourself. The Free plan is never charged: 3,000 emails a month, 100 a day. Everything before that, including the test email and domain verification, works without one.

Make your agent better at email

Each of these is optional. They give your agent Groundmail's defaults (idempotency keys, error hints, safe test sends) every time it touches email, not only during setup.

Agent Install
Claude Code /plugin marketplace add Groundmail/groundmail-skills, then /plugin install groundmail@groundmail (skills plus the MCP server)
Cursor, Codex, Gemini CLI and other agents npx skills add Groundmail/groundmail-skills -y
Cursor (project rule) Cursor rules
Claude, ChatGPT, Cursor (MCP tools) Connect https://mcp.groundmail.dev/mcp and sign in. See MCP server

The skills cover sending with POST /emails, the SDKs (Node, Python, Go, PHP, Ruby), SMTP, domain verification, webhooks, test sends and error handling. Details: Agent Skills.


For agents: machine-readable docs