Migration · Mailgun
Move from Mailgun without rebuilding the mailer.
A practical Mailgun to Transmitly migration: swap SMTP credentials, map message API fields and webhook events, then run both before cutover.
Mailgun's SMTP endpoint and messages API are both migration paths. Start with SMTP if the application already speaks it, or map the API fields and webhook events when you want structured sends. Keep Mailgun active while Transmitly verifies the domain and the event sequence is compared.
Fastest path: SMTP
Mailgun authenticates SMTP with a domain mailbox and an SMTP password. Transmitly uses apikey as the username and a Transmitly API key as the password; the From header and MAIL FROM must use the same verified domain.
- Port 587 uses STARTTLS; port 465 uses implicit TLS.
- Standard MIME, inline CID images and attachments work without a mailer change.
- Use X-Transmitly-Stream to separate transactional and marketing traffic.
- Mailgun's SMTP idempotency behavior does not carry over; use the API when exactly-once acceptance matters.
# before
SMTP_HOST=smtp.mailgun.org
SMTP_PORT=587
[email protected]
SMTP_PASSWORD=...
# after
SMTP_HOST=mail.transmitly.io
SMTP_PORT=587
SMTP_USER=apikey
SMTP_PASSWORD=txk_...If you use the messages API
Mailgun's messages endpoint is domain-scoped. Transmitly uses one endpoint and verifies the domain from the authenticated workspace. The request fields map directly except for tags and Mailgun's custom headers.
- from, to, subject, html and text map directly.
- Mailgun's o:tag values map to keys or values in the Transmitly tags object.
- Mailgun's h:X-* custom headers map to the Transmitly headers object.
- Mailgun attachments map to the Transmitly attachment array; verify binary field names before moving uploads.
- The domain in the Mailgun URL is replaced by the verified domain on the Transmitly side.
POST /v1/emails
{
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "Your receipt",
"html": "<p>Thanks for the payment.</p>",
"stream": "transactional",
"tags": { "flow": "receipt" }
}Webhook mapping
Mailgun webhooks are event-specific. Transmitly emits signed events per state change and keeps deferrals separate from hard failures.
- delivered → email.delivered_to_mx
- permanent_fail → email.bounced
- temporary_fail → email.deferred
- complained → email.complained
- opened → email.opened
- clicked → email.clicked
- unsubscribed → a preference change, not a delivery event; handle it in your subscription flow
Domain authentication and dual-run
Verify the domain in Transmitly and publish the ownership TXT plus SPF, DKIM and DMARC records. A subdomain keeps the old and new authentication records separate while both providers are active.
Send a controlled production flow through both providers. Compare acceptance, delivered-to-MX, deferrals, hard bounces and complaints. Keep Mailgun configured until the new event sequence matches.
- Use a test-only key for staging and the synthetic @transmitly.test addresses.
- Confirm the new webhook signature before enabling production consumers.
- Keep the Mailgun SMTP credentials and webhook configuration until the dual-run closes.
- Roll back by restoring the old host and credentials.
What changes after cutover
The handoff is still SMTP or HTTPS, but the delivery state is part of the sending product. Accepted, delivered-to-MX, deferred, bounced and complained are separate, with per-recipient state and replay instead of a separate events page.
Questions
Common questions
+Can I keep Mailgun active during the migration?
Yes. Keep the Mailgun credentials and webhook configuration active, run a controlled flow through both providers, and compare delivery, deferral and bounce events before moving volume.
+Does the Mailgun API domain carry over?
No. The Mailgun endpoint is domain-scoped. Transmitly uses one endpoint and resolves the sending domain from the authenticated workspace; the From address must be on a verified domain.
+How do Mailgun tags map?
Mailgun allows multiple o:tag values. Transmitly uses a key/value tags object, so map the values you need to query and keep any remaining metadata in your own store.
+Do I need to change DNS?
Yes. Verify the sending domain in Transmitly and publish SPF, DKIM and DMARC. A subdomain keeps the old and new records separate during a dual-run.
Related
See what the remote MX actually said.
Start free, verify a domain and send a test. Acceptance and delivery evidence stay separate.