# Migration from Postmark

Move transactional sends from Postmark to Groundmail without changing your product’s email jobs: receipts, password resets, alerts and invites still go out over `POST /emails`.

**Import your Postmark account (Beta).** Paste a Postmark API key on the [Import page](https://app.groundmail.dev/import?provider=postmark) and Groundmail imports your suppressions, templates and sending domains. Nothing changes in your Postmark account, and the key is never stored. Webhooks come over when you import from the terminal or the API.

**Or from the terminal**

```bash
export POSTMARK_SERVER_TOKEN=…
groundmail migrate postmark --dry-run   # preview
groundmail migrate postmark             # import
```

Groundmail brings over your **suppressions** (bounces, complaints, unsubscribes), **templates** (variables converted), **sending domains** (with the DNS records to publish, one click on Cloudflare, Vercel and GoDaddy) and, from the terminal or the API, **webhooks** (events mapped, created disabled until your handler is ready). Use a server API token; add your account API token to import sending domains too. You get a summary of what came across and what needs attention, the send-code change for your stack, and a prompt for your coding agent. Details: [Import from another provider](https://docs.groundmail.dev/migrations).

After the import, the Import page keeps a **switch checklist** for your workspace: verify your domains, send a test, point your app at Groundmail, then a cutover check on the last 24 hours of sending. Each domain gets the exact DNS changes against what it publishes today: a main domain's SPF record stays as it is (Groundmail mail passes SPF on its own return-path subdomain), a subdomain gets Groundmail's include merged into its SPF record (never a second SPF record), your DMARC record stays, and the rest are new records.

**Keep your Postmark DNS records while you switch.** Leave the `…pm._domainkey` DKIM record and the `pm-bounces` Return-Path CNAME in place: they use different names from Groundmail's, so mail from both keeps passing DKIM while your app moves over. Remove them, and `include:spf.mtasv.net` from SPF, a few days after the cutover. The import report (what came across, what was skipped and why) downloads as CSV from the Import page or with `groundmail migrate report <id> --csv`.

Sending a lot of mail? **We'll do it for you** on the Import page asks our team to run the switch with you.

The rest of this page is the same move by hand, field by field.

---

## Why teams switch

- **HTTP API + npm SDK** with a short path from API key to first send
- **Owned transactional mail infrastructure**, not a thin layer on rented cloud email
- **Free → pay as you go → Dedicated** so you can test free, run production on our shared transactional network, then move to your own managed servers and IPs when you need allowlists

---

## Quick mapping

| Postmark | Groundmail |
|----------|--------------|
| Server API token | `gm_...` API key (`Authorization: Bearer`) |
| `https://api.postmarkapp.com` | `https://api.groundmail.dev` |
| `POST /email` | `POST /emails` |
| Verified Sender Signature / domain | Verified sending domain in Groundmail |
| Message Streams | `category` on each send: `transactional` (default), `product`, or `newsletter` (approved accounts), each from its own IPs ([streams](https://docs.groundmail.dev/deliverability#transactional-and-product-streams)) |
| Webhooks | Webhooks + dashboard activity |

---

## Minimal send

```bash
curl -X POST https://api.groundmail.dev/emails \
  -H "Authorization: Bearer $GROUNDMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "you@yourdomain.com",
    "to": "user@example.com",
    "subject": "Hello",
    "html": "<p>It works.</p>"
  }'
```

Node:

```bash
npm install groundmail
```

```js
import { Groundmail } from 'groundmail'

const client = new Groundmail(process.env.GROUNDMAIL_API_KEY)
await client.emails.send({
  from: 'you@yourdomain.com',
  to: 'user@example.com',
  subject: 'Hello',
  html: '<p>It works.</p>',
})
```

---

## Migration checklist

1. Create a Groundmail account and API key
2. Add and verify your sending domain ([Domains](https://docs.groundmail.dev/domains))
3. Point your app’s send client at `https://api.groundmail.dev` with `gm_...`
4. Map Postmark fields: `From` → `from`, `To` → `to`, `Subject` → `subject`, `HtmlBody` → `html`, `TextBody` → `text`, `ReplyTo` → `reply_to`
5. Reconfigure webhooks to Groundmail endpoints ([Webhooks](https://docs.groundmail.dev/webhooks))
6. Send a canary through Sandbox or your verified domain, then cut over

HTTP aliases accepted today: `htmlBody` / `html_body`, `textBody` / `text_body` / `plain_body`, `replyTo` → `reply_to`. Postmark’s PascalCase `HtmlBody` is **not** accepted — map it to `html` (or `htmlBody`) in your client. New code should use canonical names (`html`, `text`, `reply_to`).

---

## Domains and DNS

Production `from` addresses must use a domain verified in Groundmail. Cloudflare, Vercel and GoDaddy apply flows can write records for you — see [Domains](https://docs.groundmail.dev/domains).

Before DNS is ready, self-test with the shared sandbox sender on `mail.groundmail.dev` (recipients limited to your account email). Details: [Quickstart](https://docs.groundmail.dev/quickstart).

---

## Related

- [Migration from Resend](https://docs.groundmail.dev/migration)
- [Migration from Amazon SES](https://docs.groundmail.dev/migration/ses)
- [Quickstart](https://docs.groundmail.dev/quickstart)
