Migrate from Mailgun
This page maps Mailgun's POST /v3/{domain}/messages parameters, suppression lists, and webhook events to Bird. Follow the main migration guide in order, and use these mappings for steps 1, 3, and 4.
Hand this to your agent
Paste this into Claude Code, Cursor, or Codex. The agent works through this page against your own repository, using whichever Bird surface it already has: the MCP server if one is connected, the CLI if it is installed and signed in.
Codebeispiel
I am moving an email integration from Mailgun to Bird. Route through it with me.
1. Check what you already have before setting anything up. If Bird's MCP server is connected, use its tools. If the Bird CLI is installed and signed in, use that. Either one is enough, and every step below is an action you take with whichever you have. Only if neither is present, follow https://bird.com/docs/ai/set-up-your-agent.md to set one up and sign me in. Every Bird docs page serves Markdown at its own URL with `.md` appended, so fetch that rather than the HTML.
2. Read https://bird.com/docs/guides/email/migrate/mailgun.md for the parameter, suppression and event mapping, and https://bird.com/docs/guides/email/migrate.md for the order the steps go in.
3. Find and list my Mailgun usage in this repository before you change anything: the /v3/{domain}/messages call sites and any SDK wrappers around them, every o:, v: and h: prefixed parameter I pass, my webhook handler and the URL it is registered at, and every Mailgun domain I send from. Mailgun scopes almost everything per domain, so keep that list of domains: the next two steps both work through it.
4. Register each of those sending domains with Bird and give me the DNS records to publish, following https://bird.com/docs/guides/email/sending-domains.md. Leave every DNS record Mailgun uses exactly as it is: Bird's records are published alongside them and both providers authenticate side by side until I switch traffic. Publishing DNS affects mail for the whole domain, so show me the records and let me publish them.
5. Export my suppressions from Mailgun and import them into Bird before any production traffic goes through Bird, so my first sends do not reach addresses that already bounced or complained. Mailgun keeps three lists per domain, so pull GET /v3/{domain}/bounces, GET /v3/{domain}/complaints and GET /v3/{domain}/unsubscribes for every domain you found. The Bird import takes one address per request and is idempotent, so a partial re-run is safe. https://bird.com/docs/guides/email/suppressions.md has the reason taxonomy.
6. Port the send call and the webhook handler using the mapping tables on the provider page. Two things need attention rather than translation: Mailgun reports one failed event with a severity field where Bird has separate deferred and bounced events, and Bird signs deliveries per Standard Webhooks rather than Mailgun's scheme, so treat verification as a rewrite. See https://bird.com/docs/guides/webhooks.md and https://bird.com/docs/guides/email/events.md.
7. Run my whole integration against Bird's mail sandbox before any production traffic, following https://bird.com/docs/guides/email/testing-sandbox.md. Sandbox sends run the real pipeline without reaching an inbox or touching my sending reputation.
8. Stop and ask me wherever a step needs a decision. Do not point production traffic at Bird until I have seen the sandbox results and replied with the words cut over to Bird. Retiring the Mailgun path is a separate step that comes later: ask me again and wait for me to reply with the words retire the Mailgun path. A reply that agrees without naming what it is authorising is not authorisation. Finish by telling me what is left that only a person can do.Map the send call
Mailgun's form-encoded parameter prefixes (o: options, v: variables, h: headers) all become first-class JSON fields on POST /v1/email/messages:
| What it does | Mailgun | Bird |
|---|---|---|
| Sender | from | from |
| Recipients | to / cc / bcc | to / cc / bcc (arrays) |
| Subject | subject | subject |
| Body | html / text | html / text (at least one) |
| Reply-to | h:Reply-To | reply_to (array) |
| Custom headers | h:X-* | headers (string → string object) |
| Filterable labels | o:tag | tags: {name, value} pairs |
| Round-trip context | v:* / X-Mailgun-Variables | metadata: arbitrary JSON |
| Stored template | template + t:variables | template + template.parameters |
| Scheduling | o:deliverytime | scheduled_at |
| Open/click tracking | o:tracking-opens / o:tracking-clicks | track_opens / track_clicks (default true) |
| Category | (none) | category: marketing (default) or transactional |
Our field caps and defaults (recipient counts, tag and metadata limits) live in Sending email.
Porting notes:
- The request becomes JSON. Mailgun accepts multipart form data. We take a JSON body with Content-Type: application/json. This is usually the biggest mechanical change in the port.
- v: variables were echoed in events. Our metadata works the same way. We echo your metadata (and tags) on every webhook event alongside email_id/recipient_id, so your handlers get them back without an extra lookup.
- Recipient variables don't port one-to-one. Mailgun's recipient-variables personalize many recipients in one call. Here, that job belongs to the batch endpoint, one entry per recipient, each with its own content or its own parameters values for {{ token }} substitution.
- Stored templates port directly. Mailgun's template parameter maps to our template field with values in template.parameters. See sending with a template.
- Attachments port directly. Mailgun multipart attachment / inline files become our attachments array with base64 content (set content_id for inline images). See attachments.
Export suppressions
Mailgun keeps three per-domain lists. Export each and run them through the import loop:
- GET /v3/{domain}/bounces
- GET /v3/{domain}/complaints
- GET /v3/{domain}/unsubscribes
Repeat per sending domain. Mailgun's lists are domain-scoped, while our suppressions are workspace-scoped, so the union of your domains' lists is what you import.
Translate webhook events
Mailgun signals temporary vs permanent failure with one failed event plus a severity field. We split them:
| Outcome | Mailgun | Bird |
|---|---|---|
| Accepted/processed | accepted | email.accepted → email.processed |
| Delivered | delivered | email.delivered |
| Temporary failure | failed (temporary) | email.deferred |
| Permanent bounce | failed (permanent) | email.bounced / email.out_of_band_bounce |
| Spam complaint | complained | email.complained |
| Blocked/suppressed | (none) | email.rejected |
| Open | opened | email.opened |
| Click | clicked | email.clicked |
| Unsubscribe | unsubscribed | email.list_unsubscribed |
email.rejected has no Mailgun counterpart: we report suppressed recipients visibly (status rejected, rejection_reason: recipient_suppressed) instead of silently skipping them. Add a handler for it rather than treating it as a bounce.
Verification also changes: Mailgun signs with an HMAC over timestamp + token inside the payload's signature object, while we sign per the Standard Webhooks specification, with headers rather than payload fields. Swap your verification code for the recipe in Webhooks & events.
Cut over
Work through domains & DNS and the sandbox smoke test in the main guide. Both are provider-independent.
Next steps
- Sending domains: registration, verification lifecycle, and the DNS records you're re-pointing
- Webhooks & events: endpoint setup and Standard Webhooks verification
- Testing sandbox: smoke-test the new integration before cutover
- Suppressions: confirm your imported list and how we maintain it from here