Why developers are moving away from Mailgun
Mailgun pioneered developer email in 2010, but over the years its pricing has shifted toward complex volume tiers, support response times have degraded, and its SDKs remain heavyweight wrappers over legacy multipart form data.
SadaSend provides a pure JSON REST API, instant domain DNS auto-verification, scoped API keys for AI agents, and predictable transparent pricing.
API Code Migration: Mailgun.js vs SadaSend
| Concept | Legacy Mailgun (mailgun.js) | Modern SadaSend (Native Fetch) |
|---|---|---|
| SDK Requirement | mailgun.js + form-data + buffer | 0 dependencies (Web-standard fetch) |
| Payload Format | Multipart form-data | Standard application/json |
| Authentication | Basic Auth (api:key-...) or Bearer | Standard Bearer token Authorization header |
| Domain Mapping | Requires domain in URL path | Domain inferred automatically from "from" header |
Code Migration Comparison (TypeScript)
Replace 15 lines of Mailgun client initialization with a clean 6-line native fetch call.
// BEFORE: Legacy Mailgun SDK
// import Mailgun from 'mailgun.js';
// import formData from 'form-data';
// const mg = new Mailgun(formData).client({ username: 'api', key: process.env.MAILGUN_API_KEY! });
// await mg.messages.create('mg.yourdomain.com', { from: 'hello@yourdomain.com', to: ['user@acme.com'], subject: 'Hi', text: 'Hello' });
// AFTER: Modern SadaSend Native Fetch
const res = await fetch('https://api.sadasend.com/v1/emails', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SADASEND_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: 'user@acme.com',
subject: 'Welcome to SadaSend',
text: 'Your migration is complete!',
}),
});
const data = await res.json();Zero-Downtime DNS Migration Steps
- 1. Add your sending domain in the SadaSend dashboard (/app/domains/new).
- 2. Copy the 3 DKIM CNAME records and SPF TXT record into your DNS provider (Cloudflare, Route53, Namecheap).
- 3. Once verified in SadaSend, update your environment variables (SADASEND_API_KEY) in production.
- 4. Keep your Mailgun account active for 48 hours to handle any in-flight retries before cancelling.
Building AI agents that send email?
Join the SadaSend early access waitlist to get scoped API keys, recipient allowlists, and Model Context Protocol (MCP) servers upon launch.