Postmark vs Mailgun
Postmark vs Mailgun: when Postmark's message streams and default 45-day history win, when Mailgun's Routes, EU region and scheduling matter. Code included.
Short answer: Pick Postmark for transactional-only mail with separate message streams and 45 days of message history. Pick Mailgun for inbound routing, EU region hosting, scheduled sending and native batch personalization. Both support metadata and repeated header names, so Email SDK’s field checks pass a Postmark-to-Mailgun fallback for any message, and Mailgun-to-Postmark for messages with no sendAt and at most one tag (Postmark accepts one). Falling back when delivery is unknown also needs onUnknownDelivery: “continue”, which can send a duplicate.
Postmark and Mailgun both come from the developer-tools generation of email providers, but they optimize for different things. Postmark optimizes for deliverability and clarity: separate transactional and broadcast message streams, aggressive list hygiene, detailed delivery events, and a UI your support team can actually use. Mailgun optimizes for flexibility: powerful routing and inbound parsing, EU region hosting for data residency, send-time optimization, and native scheduled delivery — the one field in the unified message shape Postmark doesn’t support. Both carry CC, BCC, reply-to, headers, attachments, tags, and metadata, so the SDK can fail over between them for most messages. Teams typically choose Postmark for critical low-volume transactional mail and Mailgun when inbound processing or EU residency is a requirement — or run both, with one as the fallback route.
Message field support
Field support as encoded in Email SDK’s own adapter capability matrix, the same data the SDK uses to reject sends that would silently drop fields.
| Message field | Postmark | Mailgun |
|---|---|---|
| CC recipients | ✓ | ✓ |
| BCC recipients | ✓ | ✓ |
| Reply-To address | ✓ | ✓ |
| Custom headers | ✓ | ✓ |
| Attachments | ✓ | ✓ |
| Tags | ✓ | ✓ |
| Metadata | ✓ | ✓ |
| Scheduled sending (sendAt) | — | ✓ |
Fallback compatibility
Failing over from Mailgun to Postmark loses: Scheduled sending (sendAt).
Same code, either provider
With Email SDK the send call is identical for both providers. Only the adapter import changes:
import { createEmailClient } from "@opencoredev/email-sdk";
import { postmark } from "@opencoredev/email-sdk/postmark";
const client = createEmailClient({
adapters: [postmark({ serverToken: process.env.POSTMARK_SERVER_TOKEN! })],
});
await client.send({
from: "hello@yourdomain.com",
to: "user@example.com",
subject: "Welcome!",
html: "<p>It works.</p>",
});
Or run both, with automatic fallback:
import { createEmailClient } from "@opencoredev/email-sdk";
import { postmark } from "@opencoredev/email-sdk/postmark";
import { mailgun } from "@opencoredev/email-sdk/mailgun";
const client = createEmailClient({
adapters: [
postmark({ serverToken: process.env.POSTMARK_SERVER_TOKEN! }),
mailgun({ apiKey: process.env.MAILGUN_API_KEY!, domain: "mg.yourdomain.com" }),
],
defaultAdapter: "postmark",
fallback: { adapters: ["mailgun"] },
});
FAQ
Should I use Postmark or Mailgun?
Pick Postmark for transactional-only mail with separate message streams and 45 days of message history. Pick Mailgun for inbound routing, EU region hosting, scheduled sending and native batch personalization. Both support metadata and repeated header names, so Email SDK’s field checks pass a Postmark-to-Mailgun fallback for any message, and Mailgun-to-Postmark for messages with no sendAt and at most one tag (Postmark accepts one). Falling back when delivery is unknown also needs onUnknownDelivery: “continue”, which can send a duplicate.
Can I switch from Postmark to Mailgun without rewriting my email code?
Yes. With Email SDK both providers share one typed send() call and one message shape, so switching from Postmark to Mailgun is a one-line adapter change plus an API key. The SDK fails fast if a message uses a field Mailgun does not support, so nothing is silently dropped.
Which message fields does Postmark support that Mailgun doesn’t?
Mailgun supports every message field that Postmark supports, so nothing is lost moving a message from Postmark to Mailgun.
Can I use Mailgun as a fallback for Postmark?
Partially. Email SDK checks field support before every send: a fallback is rejected from Mailgun to Postmark for messages using Scheduled sending (sendAt). Messages that avoid those pass the field checks. A failed send still falls back only when the SDK knows the first provider didn’t send it, unless you set onUnknownDelivery: “continue”. Adapter limits also apply. Postmark: Accepts one tag and flattens one name:value tag for the provider payload. Mailgun: Native personalized delivery caps one request at 1,000 recipients. Mailgun: Tag names are discarded; tag values are sent as o:tag values.
Adapter docs
Setup guides: Postmark adapter and Mailgun adapter. Sending from your own domain? Verify SPF, DKIM, and DMARC with the free email DNS checker.
Moving off Postmark? Read the Postmark alternatives guide.
Calling the API directly? Read the Mailgun API guide for Node.js and TypeScript.
Moving off Mailgun? Read the Mailgun alternatives guide.
Estimating the bill? Read the Mailgun pricing guide.