Self-hosted SMTP beats Mailgun on cost at 100K+ emails/month, saving $40-500+/month depending on volume. Mailgun wins on simplicity, reliability, and developer experience. Switch to self-hosted when you're sending 200K+ monthly with technical resources to maintain infrastructure; stay with Mailgun when reliability and developer time are more valuable than hosting costs.
Self-Hosted SMTP vs Mailgun: Cost Analysis and When to Switch
The Financial Comparison
Let's start with the numbers that matter.
Mailgun Pricing
| Volume/Month | Mailgun Cost |
|---|---|
| 5,000 (free tier) | $0 |
| 50,000 | $35 |
| 100,000 | $75 |
| 250,000 | $165 |
| 500,000 | $325 |
| 1,000,000 | $650 |
Mailgun's pricing is $0.80/1,000 emails after the free tier.
Self-Hosted Costs
| Component | Monthly Cost |
|---|---|
| VPS (Hetzner CX31, 8GB RAM) | $12 |
| Additional storage | $5-10 |
| Monitoring (optional) | $0-15 |
| Backup | $5 |
| Total | $22-42 |
Volume doesn't change server costs until you need to scale hardware.
Monthly Savings by Volume
| Volume | Mailgun | Self-Hosted | Savings |
|---|---|---|---|
| 50K | $35 | $25 | $10 |
| 100K | $75 | $25 | $50 |
| 250K | $165 | $30 | $135 |
| 500K | $325 | $35 | $290 |
| 1M | $650 | $50 | $600 |
At 500K+ emails/month, you're saving $3,000+ annually.
Practitioner note: These numbers don't include your time. If maintenance takes 4 hours monthly at $100/hour opportunity cost, the real savings at 250K are $135 - $400 = -$265. You need higher volume or lower time investment for self-hosting to win.
What Mailgun Provides
Your Mailgun subscription includes:
- Managed infrastructure — Servers, scaling, redundancy
- Pre-warmed IPs — Ready to send immediately
- Deliverability management — ISP relationships, reputation handling
- APIs and SDKs — Developer-friendly integration
- Webhooks — Bounce, complaint, delivery notifications
- Analytics — Engagement tracking
- Support — Help when things break
- Compliance — Automatic suppression, FBL processing
You're paying for an email operations team.
What Self-Hosting Requires
When you self-host, you provide:
- Server management — Updates, security, monitoring
- IP warming — 2-4 weeks before full volume
- Reputation monitoring — Check blacklists, handle issues
- Bounce processing — Build or configure handling
- Security — Prevent abuse, handle compromises
- Troubleshooting — Diagnose delivery problems
- Backup/recovery — Protect against data loss
This is ongoing work, not one-time setup.
Self-Hosted Options for Mailgun Replacement
Postal
Most Mailgun-like self-hosted option:
- Built for transactional email
- Web UI for management
- Click/open tracking
- Webhooks
- API access
- Multiple organizations
Best fit for developers coming from Mailgun.
Mailcow
Full-featured email server:
- Complete email solution (send + receive)
- Docker-based deployment
- Web admin interface
- More than just sending
Better for organizations wanting full email infrastructure.
Postfix + Custom
Minimal setup:
- Just the MTA
- Maximum control
- No GUI overhead
- Requires more expertise
Best for experienced sysadmins.
See our Postal setup guide for Mailgun-replacement focused deployment.
Deliverability Comparison
Mailgun Deliverability
- Established IP reputation
- ISP relationships managed
- Automatic FBL processing
- Dedicated IPs available ($35/month)
- Deliverability team monitoring
Start sending immediately with good inbox placement.
Self-Hosted Deliverability
- Fresh IP (no reputation)
- Must warm over 2-4 weeks
- Manual reputation management
- Blacklist monitoring required
- You handle ISP issues
Same results possible, but requires knowledge and effort.
Practitioner note: The biggest deliverability risk with self-hosted isn't the steady state—it's the transition. Cutting over from Mailgun to self-hosted without proper warmup can crash your deliverability. Run parallel for 4-6 weeks minimum.
Developer Experience Comparison
Mailgun DX
- Clean REST API
- Official SDKs (Python, Ruby, PHP, Go, etc.)
- Excellent documentation
- Sandbox for testing
- Webhook debugging tools
Mailgun is known for developer experience.
Self-Hosted DX
- SMTP (universal but basic)
- API depends on software choice
- Postal has reasonable API
- Less documentation
- More DIY debugging
Postal approaches Mailgun's DX; other options require more custom work.
When to Stay with Mailgun
Keep using Mailgun if:
- Volume under 200K/month — Savings don't justify effort
- No dedicated technical resources — Nobody to maintain
- Developer productivity matters — Don't want custom integration
- Reliability is critical — Can't afford self-hosted risks
- Email isn't core infrastructure — Focus on product instead
For most startups and SMBs, Mailgun is the right choice.
When to Self-Host
Consider self-hosting if:
- Volume exceeds 500K/month — Significant cost savings
- Technical team available — Can absorb maintenance
- Data sovereignty required — Must control infrastructure
- Cost reduction is strategic — Every dollar matters
- Already managing servers — Marginal additional work
- GoHighLevel agency at scale — Per-client SMTP needs
Migration: Mailgun to Self-Hosted
Careful migration prevents deliverability loss:
- Set up self-hosted server (Postal recommended for Mailgun users)
- Configure DNS — SPF, DKIM, DMARC, PTR
- Begin warmup — 100-200 emails/day to start
- Run parallel sending — 90% Mailgun, 10% self-hosted
- Gradually shift traffic — Over 4-6 weeks
- Monitor deliverability — Watch inbox placement
- Complete cutover — When self-hosted matches Mailgun performance
- Keep Mailgun as fallback — For 30 days post-migration
Don't rush this process. Warmup period is non-negotiable.
Migration: Self-Hosted to Mailgun
If simplifying:
- Sign up for Mailgun
- Verify domain (DNS records)
- Update application to use Mailgun API/SMTP
- Test thoroughly
- Cutover — Mailgun's infrastructure is pre-warmed
- Decommission self-hosted
This direction is straightforward—Mailgun handles complexity.
Hybrid Approach
Common pattern for agencies:
- Mailgun for clients wanting managed service
- Self-hosted for cost-sensitive high-volume clients
Or:
- Mailgun for critical transactional (password resets)
- Self-hosted for high-volume notifications
Match infrastructure to requirements.
GoHighLevel Consideration
For GoHighLevel agencies specifically:
Mailgun integrates easily with GHL's SMTP settings and is reliable.
Self-hosted (Mailcow, Postal) also works via SMTP credentials and saves money at scale.
See our GoHighLevel + Mailgun setup and GoHighLevel + Mailcow integration for specific implementation guides.
The Bottom Line
| Factor | Mailgun | Self-Hosted |
|---|---|---|
| Cost (500K/mo) | ~$325 | ~$35 |
| Setup time | Minutes | Hours/days |
| Ongoing maintenance | None | 2-5 hrs/month |
| Deliverability | Excellent (managed) | Good (with effort) |
| Reliability | High (SLA) | Depends on you |
| Developer experience | Excellent | Variable |
Mailgun is right for most businesses. Simple, reliable, good DX.
Self-hosted is right for high-volume cost-conscious senders with technical resources.
Be honest about the maintenance commitment before switching.
If you're considering self-hosted email infrastructure and want help assessing whether it fits your situation, schedule a consultation for an honest cost-benefit analysis.
Sources
v1.0 · March 2026
Frequently Asked Questions
At what volume should I switch from Mailgun to self-hosted?
The financial break-even is around 100K emails/month, but practical break-even is 200-500K when factoring maintenance time. Below 200K, Mailgun's simplicity usually outweighs the cost savings.
How much does self-hosted SMTP cost compared to Mailgun?
Self-hosted: $20-50/month (server) regardless of volume. Mailgun: $0.80/1,000 emails after free tier. At 500K emails/month: self-hosted ~$35, Mailgun ~$325. Savings: ~$290/month.
Is self-hosted email deliverability as good as Mailgun?
It can be, but requires work. Mailgun's IPs are pre-warmed with established reputation. Self-hosted starts fresh and needs 2-4 weeks warmup plus ongoing reputation management.
What skills are needed to run a self-hosted email server?
Linux administration, DNS management, email authentication (SPF/DKIM/DMARC), security hardening, monitoring setup, and troubleshooting ability. Budget 2-5 hours monthly for maintenance.
Can I use self-hosted SMTP with GoHighLevel?
Yes. GoHighLevel accepts custom SMTP credentials. Self-hosted servers like Mailcow or Postal work as SMTP providers for GHL workflows. See our GoHighLevel SMTP setup guides.
Want this handled for you?
Free 30-minute strategy call. Walk away with a plan either way.