Migrate from Mailgun to sendvia

Your own AWS setup, a re-verified domain, and two call sites to update, for the outbound side. Keep inbound application routes in place; browser webmail is a separate Cloudflare setup.

Last reviewed:

This page walks through moving outbound sending from Mailgun to sendvia. The short version: an AWS account of your own, a domain re-verified under your own SES identity, and two call sites in your codebase to update. If anything on the domain also receives mail, read step three before you touch a record.

01What you will need

02Set up SES and connect it

Create the AWS account first if you do not already have one, then a dedicated IAM user for sendvia rather than the account root. The setup guide covers both, along with requesting production access.

A new SES account starts inside Amazon's sandbox: sending is limited to email addresses you have verified individually, at up to 200 a day. Amazon reviews a production access request itself, and typically clears it in 12 to 24 hours. You can add and verify a domain while still in sandbox, so start the request early and use the wait for the next two steps.

Once the IAM user exists, paste its access key and secret into sendvia and add the sending domain. sendvia generates the records the next step needs.

03Move the DNS records

This guide moves outbound sending. Keep receiving MX records and inbound application routes in place during that migration. Premium webmail can provide browser inboxes through Cloudflare, but it does not replace a public inbound API. Plan a mailbox move separately with the webmail setup guide.

Before: what a Mailgun domain typically carries
Record What it did
SPF and DKIM (TXT)Authorised and signed outbound mail. This half moves.
Tracking (CNAME)Routed open and click tracking through a subdomain. This half moves.
MX, if you receive mailDelivers inbound mail to be routed, parsed and stored. Keep these during the outbound migration. Browser mailbox delivery can be moved separately to Cloudflare webmail; inbound application routes are not imported.
Read from the domains section of Mailgun's user manual. All were added by hand at the registrar or host.

The SPF and DKIM entries above can come out once the records below are confirmed active. sendvia's own DNS panel checks each one live and marks it once it resolves.

After: what sendvia asks for, generated per domain
Type Host Value
CNAME × 3<token>._domainkey.yourdomain.com<token>.dkim.amazonses.com
MX (new host)bounce.yourdomain.com10 feedback-smtp.us-east-1.amazonses.com
TXTbounce.yourdomain.comv=spf1 include:amazonses.com ~all
TXT_dmarc.yourdomain.comv=DMARC1; p=none; rua=mailto:[email protected]

Note that sendvia's MX above sits on bounce.yourdomain.com, not on the domain apex, so it cannot collide with an inbound MX kept at the apex for receiving mail. The two can coexist. That bounce subdomain is sendvia's MAIL FROM host: always a bounce subdomain of the domain you send from, never a plain sender-looking subdomain, because that shape is too easily mistaken for a customer's own inbox. Skip it and the SPF TXT above authenticates nothing at all, so it changes nothing: SES falls back to its own amazonses.com envelope domain and DMARC ends up resting on DKIM alone. Once DKIM and DMARC are both confirmed, tighten the DMARC policy from p=none to p=quarantine and then p=reject, and add BIMI if you publish a brand logo. The setup guide covers both.

04Swap the API call

Mailgun takes POST https://api.mailgun.net/v3/yourdomain.com/messages as an ordinary form post rather than JSON, authenticated with HTTP basic auth under the literal username api.

sendvia
curl -X POST https://api.sendvia.io/v1/send \
  -H "Authorization: Bearer sv_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "from":    "[email protected]",
    "to":      "[email protected]",
    "subject": "Your receipt",
    "html":    "<p>Thanks for your order.</p>"
  }'

Read from app/api.php on .

Mailgun
curl -X POST https://api.mailgun.net/v3/yourdomain.com/messages \
  --user "api:your_api_key" \
  -F from="[email protected]" \
  -F to="[email protected]" \
  -F subject="Your receipt" \
  -F text="Thanks for your order."

Read from documentation.mailgun.com on .

Both answer with JSON and both report a result per recipient. A successful sendvia call comes back as {"success":true,"total":1,"sent":1,"failed":0} plus a results array.

The reply that surprises a reader arriving from a provider which owns the sending account is the 422. sendvia refuses a from-address on a domain it has not verified inside your own SES account, because it has no sending identity of its own to fall back on. Verify the domain and the same call goes through.

# 422 {"error":"The domain \"yourdomain.com\" has not been verified. Add and verify it in the dashboard first."}

Two ceilings worth knowing before you port a batch job: a single call takes up to 50 recipients, and /v1/send/batch takes up to 500 messages. A scheduled send accepts send_at up to 72 hours ahead.

05Swap the SMTP settings

The same swap applies wherever your codebase or transactional templates send mail through a relay rather than the HTTP API. Mailgun publishes SMTP settings of its own at smtp.mailgun.org, on ports 25, 465, 587 and 2525. On sendvia the relay is a paid add-on on top of Premium, switched on by request, so ask for it before the cutover if anything you run still sends over SMTP.

SMTP relay, old and new.
DetailMailgunsendvia
SMTP relayYes, alongside the HTTP APIYes, an SMTP relay on 587 with 2525 as a fallback
The Mailgun column was read from www.mailgun.com on . The sendvia column comes from sendvia_profile() in app/data/competitors.php, which is sourced to the code that implements each answer rather than to a marketing page, and reads any plan figure in it straight out of app/config.php.

Point whatever library or mail transfer agent you use at the new host, port and credentials, and nothing else about the message needs to change.

curl --url smtp://smtp.sendvia.io:587 \
  --user "sendvia:sv_live_your_api_key" \
  --mail-from [email protected] \
  --mail-rcpt [email protected] \
  --upload-file receipt.eml

06Verify and cut over

Run both providers in parallel before you retire the old one, for outbound mail at least. Send the same traffic through each for a week, compare what lands in the inbox and the spam folder, and watch bounce and complaint rates on both sides before you touch the old key.

What it records against a message is a bounce, a complaint, a delivery delay or a rejection, published by SES to an SNS topic in your own account. Delivery is not on that list. sendvia marks a message delivered when nothing has gone wrong two minutes after it was sent, which is an inference rather than a confirmation. Resend, Postmark, Mailgun and SendGrid all receive a real delivery event from their own systems. Premium webmail uses a separate stream of confirmed SES events; that does not add delivery events to the public sending API. If your parallel run needs a real delivery signal to compare against, get it from the side still running through Mailgun.

Once bounce and complaint rates hold steady and the logs agree, move the remaining outbound traffic over and cancel only what you are certain sends nothing and receives nothing. sendvia keeps 7 days of send logs on the free plan and 90 on the paid one, so keep the old provider's own history if you need it further back than that.

What you will lose by moving

Moving is not free of trade-offs. This is what the data on this site records Mailgun doing that sendvia does not. Read it before you commit to a date.

  • Your application needs an inbound API. Mailgun routes inbound mail, parses it and stores the raw MIME for you to fetch. sendvia offers browser webmail through Cloudflare, but has no public inbound API for application workflows. Source
  • You have an old list and want the dead addresses out before you send to it. Mailgun validates addresses in real time at signup or in bulk from a CSV. sendvia has nothing equivalent and will happily send to all of them. Source

Set against that: no dedicated IP option, no public inbound API, no dashboard teams or sub-accounts and no official SDKs are what sendvia’s dashboard and public sending API do not provide. Premium webmail has separate mailbox logins and receiving through Cloudflare. Weigh both lists before you start, not after.