# Migration from Amazon SES

If you send transactional mail through Amazon SES (SDK, SMTP, or a thin API on top of SES), you can move the application-facing send path to Groundmail while keeping the same jobs: auth mail, receipts, alerts, and notifications.

**Import your Amazon SES account (Beta).** Paste an AWS access key with the [read-only policy below](#create-a-read-only-key) on the [Import page](https://app.groundmail.dev/import?provider=ses) and Groundmail imports your suppressions, templates and sending domains from one SES region, and reports where your events go. Nothing changes in your AWS account, and the key is never stored.

**Or from the terminal**

```bash
export AWS_ACCESS_KEY_ID=AKIA… AWS_SECRET_ACCESS_KEY=…
# or, with the AWS CLI signed in: eval "$(aws configure export-credentials --format env)"
groundmail migrate ses --region us-east-1 --dry-run   # preview: nothing is written
groundmail migrate ses --region us-east-1             # import
```

Either way, Groundmail brings over, from one SES region:

- **Suppressions**: the account-level suppression list (bounces and complaints).
- **Templates**: Handlebars variables converted (`{{user.name}}` becomes `{{user_name}}`), and `{{amazonSESUnsubscribeUrl}}` becomes Groundmail's managed unsubscribe link. Templates with `{{#if}}` or `{{#each}}` come in as drafts with a note.
- **Sending domains**: your verified domain identities, with the DNS records to publish (one click on Cloudflare, Vercel and GoDaddy). Single email-address identities are listed, not imported: Groundmail sends from verified domains.
- **Event destinations, reported**: SES has no webhooks, so nothing is created. The report lists where each configuration set sends events (SNS, EventBridge, Firehose) and which Groundmail webhook events match, so you can add the webhook yourself.

### Create a read-only key

Attach this policy to an IAM user (or role), create an access key for it, run the import, then delete the key. It allows only the read calls the import makes:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "GroundmailImportReadOnly",
      "Effect": "Allow",
      "Action": [
        "ses:ListEmailIdentities",
        "ses:GetEmailIdentity",
        "ses:ListEmailTemplates",
        "ses:GetEmailTemplate",
        "ses:ListSuppressedDestinations",
        "ses:ListConfigurationSets",
        "ses:GetConfigurationSetEventDestinations"
      ],
      "Resource": "*"
    }
  ]
}
```

**One region per import.** SES keeps identities, templates and suppressions per region; run the import again for each region you send from.

**Keep your SES DNS records while you switch.** Leave the three `<token>._domainkey` DKIM CNAMEs, and the MX and SPF records on your custom MAIL FROM subdomain if you set one up, in place until your app sends only through Groundmail. The import report names them for each domain, and has the send-code change for your stack and a prompt for your coding agent. Details: [Import from another provider](https://docs.groundmail.dev/migrations).

---

## What changes

| SES-oriented setup | Groundmail |
|--------------------|--------------|
| AWS credentials / IAM | `gm_...` API key |
| Regional SES endpoint | `https://api.groundmail.dev` |
| `SendEmail` / `SendRawEmail` | `POST /emails` |
| SES-verified identity | Groundmail verified domain |
| Configuration sets / event destinations | Webhooks + dashboard activity |
| Shared SES IP pools (typical) | Our owned shared transactional network (Free and pay as you go), dedicated IPs, or Dedicated (your own managed servers + IPs) |

Groundmail runs on **owned mail infrastructure**, not as a reseller of SES. That matters when you care who else shares the pipe — and when you later need Dedicated isolation.

---

## 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>"
  }'
```

```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. Sign up at [app.groundmail.dev](https://app.groundmail.dev) and create an API key
2. Verify your sending domain ([Domains](https://docs.groundmail.dev/domains)) — SPF, DKIM, return path
3. Replace SES SDK calls with Groundmail HTTP or the `groundmail` npm package
4. Map bodies: HTML → `html`, text → `text`, reply addresses → `reply_to`
5. Point bounce/complaint/delivery handling at Groundmail [webhooks](https://docs.groundmail.dev/webhooks)
6. Run parallel canary sends, then shift production traffic

---

## Sandbox vs production

- **Sandbox:** send from `noreply@mail.groundmail.dev` to your account email only while integrating
- **Free production:** verified domain **and** a payment method on file (Free is never charged) — 3,000 emails/mo · 100/day · 3 domains on our shared transactional network
- **Pay as you go:** $15 a month includes 20,000 emails, then $0.70 per 1,000 up to 100,000, $0.50 from 100,000 to 1 million and $0.30 above, each rate only on the emails in its band · up to 1,000 domains · one dedicated IP included from 100,000 emails a month
- **Dedicated ($249/mo plus pay-as-you-go sending):** managed server and IPs when you need isolation

See [Pricing](https://groundmail.dev/pricing/) and [Quickstart](https://docs.groundmail.dev/quickstart).

---

## SMTP

SES SMTP users can move to Groundmail SMTP relay: host `smtp.groundmail.dev`, port `587` (STARTTLS), username `groundmail`, password from a dashboard SMTP credential (`gmsmtp_…`). Same verified domains, plan limits, and suppressions as the HTTP API. Prefer `POST /emails` for new app code; use SMTP when the integration only exposes an SMTP form. Details: [SMTP](https://docs.groundmail.dev/smtp).

---

## Related

- [Migration from Resend](https://docs.groundmail.dev/migration)
- [Migration from Postmark](https://docs.groundmail.dev/migration/postmark)
- [Quickstart](https://docs.groundmail.dev/quickstart)
