Open dashboard
Docs
Guide

Migrate from inbound.new

Move domains, addresses, webhooks, forwards and IMAP mailboxes from inbound.new, with their mail, while inbound.new keeps receiving until you switch.

Quickstart

  1. Sign in at nightmail.dev and create an API key: API keys → Create key, with full access (manage) and no domain or address limit.
  2. Run the migration script, first as a dry run, then with --apply (see Use the migration script). It adds your domains, inboxes, webhooks and forwards in Nightmail and never touches inbound.new. To do it by hand instead, add the domain in Domains → Add domain.
  3. Publish the DNS records the script prints (or the domain’s page lists) beside inbound.new’s records, then run the script with --apply again until nothing is waiting.
  4. Switch. Deploy your app with the new webhook secret, copy each mailbox with imapsync and point mail apps at Nightmail. If the domain’s receiving MX record in Nightmail is the one you already have (both use Amazon SES in us-east-2: inbound-smtp.us-east-2.amazonaws.com), leave DNS as it is; otherwise replace inbound.new’s MX record with Nightmail’s.
  5. Test, then remove the domain from inbound.new. Send an email from another account to each address and find it in Nightmail’s Logs → Received. Removing the domain from inbound.new stops it receiving there; until then it may receive some of your mail too.

Hand this to your coding agent

Paste this into Claude Code, OpenCode, Cursor or Codex, opened in your app’s repository:

Migrate this project from inbound.new to Nightmail. Follow https://nightmail.dev/docs/migrate-from-inbound.md.

1. With INBOUND_API_KEY and NIGHTMAIL_API_KEY from my environment, run `npx -y @nightmail/sdk@latest migrate-inbound` (a dry run) and show me its plan. Run it with `--apply --secrets-out ./nightmail-secrets.json` only after I say yes.
2. In this repository, replace the inboundemail SDK with @nightmail/sdk: verify webhooks with verifyWebhook and the new signing secret, keep the inbound.new payload shape (the webhooks use format "inbound"), and map every API call with the table in that guide.
3. Never print API keys or secrets, never delete anything on inbound.new, and list what you couldn't migrate.

Move an IMAP mailbox and all its mail

An inbound.new mailbox becomes a Nightmail persistent inbox: one address, kept until you delete it, with no message cap, that mail apps open with an app password. imapsync copies every folder with its messages’ dates and flags.

  1. Create the inbox. The migration script makes one for each mailbox. By hand, with your API key:
curl --request POST https://nightmail.dev/v1/inboxes \
  --header "Authorization: Bearer $NIGHTMAIL_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"type":"persistent","domain":"example.com","localPart":"me","name":"Me"}'

Use persistent: agent inboxes expire and hold at most 200 messages and 25 MiB. Mail apps can’t open them.

  1. Create an app password in SMTP & IMAP → Create app password, or run the script with --create-app-passwords. Save it in nightmail.pass, and the inbound.new mailbox password in inbound.pass. A read-only inbound.new credential is enough to copy from.
  2. Copy the mail:
imapsync \
  --host1 imap.inboundemail.com --port1 993 --ssl1 --user1 'me@example.com' --passfile1 ./inbound.pass \
  --host2 imap.nightmail.dev --port2 993 --ssl2 --user2 'me@example.com' --passfile2 ./nightmail.pass \
  --automap --syncinternaldates --useuid --maxmessagespersecond 4 --exclude '^Scopes'

--maxmessagespersecond 4 keeps under Nightmail’s 300 messages a minute per inbox, --useuid lets a second run copy only what’s new, --automap matches Sent, Drafts, Junk, Archive and Trash, and --exclude '^Scopes' skips inbound.new’s Scopes/… folders, which repeat INBOX. inbound.new fills a large INBOX in batches of 500, so run the command again until it copies nothing.

  1. Point your mail app at Nightmail and delete the old account from it:
SettingIncoming (IMAP)Outgoing (SMTP)
Serverimap.nightmail.devsmtp.nightmail.dev
Port993 (TLS) or 143 (STARTTLS)465 (TLS) or 587 (STARTTLS)
UsernameThe inbox’s addressThe inbox’s address
PasswordThe app passwordThe app password

What the copy does and doesn’t do:

Copied mail
Webhooks, forwards, rules, AI decisionsNever run on copied mail: an IMAP APPEND stores it, nothing more.
Dates, folders, flagsKept as they were.
Message sizeUp to 40 MiB each.
Pace300 messages a minute per inbox; uploads after the first 64 MiB go at 8 MiB/s.
FoldersUp to 1,000 per inbox. INBOX, Sent, Drafts, Junk, Archive and Trash are built in.
Inbox sizeNo cap on a persistent inbox.

Use the migration script

The script reads inbound.new’s API and writes only to Nightmail. Keys come from the environment, never the command line:

# Your inbound.new API key, and a Nightmail key with full access (manage)
export INBOUND_API_KEY=…
export NIGHTMAIL_API_KEY=…

# A dry run: prints the plan and creates nothing
npx -y @nightmail/sdk@latest migrate-inbound

# Create it, keeping new secrets in a file only you can read
npx -y @nightmail/sdk@latest migrate-inbound --apply --secrets-out ./nightmail-secrets.json
inbound.newNightmail
DomainDomain, receiving at the same host. Its DNS records are printed.
Email addressPersistent inbox, plus a route when the address posts to a webhook or forwards.
Webhook endpointWebhook with format: "inbound", a 30-second timeout and the same custom headers.
Email and email group endpointsOne forward per recipient. Recipients on your own verified domains are ready at once; others confirm by email.
Slack or Discord webhookSlack or Discord endpoint and a Post to Slack (or Discord) rule on the address.
Catch-allA *@domain route to the same destinations.
IMAP mailboxPersistent inbox, with an app password if you pass --create-app-passwords, and its imapsync command.
  • Safe to run again. Anything that exists is skipped, so run it after publishing DNS: steps waiting for the domain to receive (inboxes, and the routes and rules on them) finish then. --domain example.com migrates one domain at a time; --json prints the plan and results as JSON.
  • Secrets are shown once. New webhook signing secrets and app passwords go to the --secrets-out file (mode 0600), or print with --show-secrets. A run that would create one refuses to start without either.
  • What it never does: delete anything, on either side, or change DNS.
  • What you do by hand: publish the DNS records, put each webhook’s new secret in your app, run imapsync with the mailbox passwords, and remove the domain from inbound.new. The plan also lists what it found but can’t migrate: Guard rules, SMTP-only logins, subdomain receiving and mailbox filters.

Webhooks and the SDK

Webhooks the script creates use format: "inbound": the same email.received body your handler reads today, with inbound.new’s headers (X-Webhook-Verification-Token, X-Endpoint-ID, X-Webhook-Event, X-Webhook-Timestamp). What changes in it:

  • IDs: messages are msg_…, threads thr_…, the endpoint mwh_….
  • email.threadPosition isn’t sent, and spam.reason is ses_spam or null.
  • The body is at most 512 KiB. A longer one sets email.bodyTruncated and links the full message (email.messageUrl, parsedData.rawUrl); attachments of a message over 6 MiB are fetched from rawUrl.

X-Webhook-Verification-Token has a new value (verificationToken, in the secrets file), so a handler that compares it keeps working once you update it. Better: check the signature every delivery carries, with the webhook’s secret. inbound.new’s verifyWebhookFromHeaders won’t work with Nightmail.

import { verifyWebhook, type InboundWebhookPayload } from '@nightmail/sdk/webhooks';

export async function POST(request: Request) {
  const body = await request.text(); // the raw body, before JSON.parse
  const secret = process.env.NIGHTMAIL_WEBHOOK_SECRET!;
  if (!(await verifyWebhook(body, request.headers, secret))) {
    return new Response(null, { status: 401 });
  }
  const payload: InboundWebhookPayload = JSON.parse(body);
  // …your existing email.received handling
  return new Response(null, { status: 204 });
}

Replace inboundemail with @nightmail/sdk and INBOUND_API_KEY with NIGHTMAIL_API_KEY. Each call maps to one operation:

inbound.newNightmail
emails.sendsendEmail: from takes Name <address>, or a bare address with fromName; attachments are uploaded first
emails.send with scheduled_at, emails.delete (scheduled)sendEmail with scheduledAt, cancelEmail, rescheduleEmail
emails.replyreplyToInboundThread
emails.retrieve, emails.list (received)getInboundMessage, listInboundMessages
emails.retrieve, emails.list (sent)getEmail, listEmails
mail.list, mail.retrievelistInboundThreads, getInboundThread
emails.update (read, archived, junk)updateInboundThread
Attachment downloadUrlThe payload’s downloadUrl, or getInboundAttachment
domains.createcreateDomain
emailAddresses.createcreateInbox with type: "persistent"
endpoints.create (webhook)createInboundWebhook with format: "inbound"
endpoints.create (email, Slack, Discord)createEndpoint
mailboxes.createcreateInbox with type: "persistent", then createInboxAppPassword

What doesn’t transfer

  • *.inbnd.dev addresses. inbound.new’s managed domain stays there. Move that mail to a domain you own. Nightmail’s built-in *.nightmail.email domain receives at once, but for now it sends only to your workspace’s own members.
  • Email history outside mailboxes. Received and sent emails you only reached through inbound.new’s API or dashboard aren’t imported. Export what you need before removing the domain. Mailboxes come with all their mail through imapsync.
  • tags on sends. Nightmail has no tags: remove them from emails.send calls.
  • Raw MIME sends over HTTP. Send raw messages over SMTP instead (smtp.nightmail.dev, an SMTP login from API keys).
  • Mailbox filters and IP allowlists. Folder-move and flag filters don’t transfer: recreate them as rules or in your mail app.
  • Forward subject prefixes and custom From. A forward comes from the receiving address, with the original sender’s name.
  • Guard rules. Recreate them as rules: block or allow senders, or ask the AI.

Pricing and limits

  • Free every month: 5,000 sent and 20,000 received emails. After that, $0.20 per 1,000, sent or received. AI decisions in rules, IMAP and SMTP cost nothing. Received mail older than 90 days is $0.25 per GB-month after the first 1 GB.
  • Prepaid: top-ups from $20; credit lasts 12 months. See Pricing.
  • Domains: up to 100 per workspace. Write to support@nightmail.dev for more.
  • A new workspace’s first sends: its first 500 recipients are an evaluation, then volume grows for 24 hours from 1,000 recipients an hour. If you send more than that from day one, write to support@nightmail.dev before you switch.