Open-source self-hosted email API vs SES, Mailgun, SendGrid
An open-source, self-hosted email API such as Hyvor Relay gives you control over your data, your queue and your cost structure. It does not give you IP reputation. Gmail and Outlook still judge your mail by the IP it comes from, so settle that question first, then pick a tool.
Sohail Hussain11 min readShort answer
- A self-hosted, open-source email API such as Hyvor Relay can replace SES, Mailgun or SendGrid as software, but not as a source of IP addresses with an established sending reputation.
- You can run the API, queue and bounce handling yourself, yet Gmail and Outlook will still judge your mail by the IP it comes from. Plan to earn that reputation from scratch.
- Choose self-hosting for control, data location or cost structure; choose a managed vendor if delivery to major inboxes matters most.
You searched for a self-hosted, open-source alternative to SES, Mailgun or SendGrid, probably because you want your sending pipeline on your own servers. That is a reasonable goal. This page covers what self-hosting gives you, what it leaves on your plate, and which option fits which team.
Why people look at self-hosted sending
A launch post for Hyvor Relay, an open-source self-hosted email API, drew a lot of interest on r/selfhosted in late 2025. The comments are a useful map of what people want and worry about:
- Control over data and over the sending pipeline.
- Costs that do not scale per message with a third party.
- Worry about blacklists, since a self-run IP has no cushion.
- Questions about bounce auto-suppression: does the software stop you from mailing dead addresses by itself?
- Confusion about mailcow versus a relay, which are different tools (covered below).
None of this is a complaint that SES, Mailgun or SendGrid is broken. It is a demand signal: some teams want the software layer on their own infrastructure.
The quick comparison
| Option | Who owns the sending IPs | Best for | Main catch |
|---|---|---|---|
| Hyvor Relay | You | Teams that want an open-source email API on their own servers | You carry IP reputation and operations |
| Postal | You | Self-hosters who want an open-source mail delivery platform | Same IP and operations burden |
| Amazon SES | AWS (shared pools by default; dedicated IPs optional) | Cost-sensitive senders already on AWS | Sandbox at first, minimal tooling |
| Mailgun | Mailgun (shared or dedicated) | Developers who want an API with webhooks and logs | Plans and limits change; check current terms |
| SendGrid | Twilio SendGrid (shared or dedicated) | Teams that want transactional and marketing mail at one vendor | Shared-pool effects; check current plans |
I left prices out on purpose. They change, and a stale number is worse than none. Check each vendor's pricing page for the current figures as of November 2026.
Hyvor Relay
Hyvor Relay is an open-source, self-hosted email API from the Hyvor team. You run it on your own servers and send through its API instead of a vendor's cloud. I have not run it in production, so I will not describe its internals; read the project's repository and docs for the current feature list and license.
Good at: owning the whole pipeline and keeping message data on infrastructure you control.
Lacks: anything only a long-lived sender has. A fresh IP has no history with Gmail, Microsoft or Yahoo, and software cannot fix that.
Suits: engineers who already run servers, send a predictable volume of transactional mail, and are comfortable owning DNS, IP reputation and on-call.
Before you commit, ask the project these questions (the community discussion kept circling them):
- Does it parse bounces and complaints and suppress hard-bounced addresses automatically?
- Can it send from several IPs, and can you pace volume per IP and per receiving domain?
- Does it sign with DKIM per domain?
- What webhooks or events does it emit for delivery, bounce and complaint?
- How do you upgrade it without losing the queue?
- Can it hand mail to an upstream SMTP relay?
Postal
Postal is another open-source mail delivery platform you host yourself. It is older than the newer API projects, so more written advice exists about it. It faces the same constraints: your IPs, your reputation, your port 25 access. Put it through the same question list.
Amazon SES
SES is the usual answer when the goal is cheap and reliable. You send over SMTP or the API from AWS-run IP pools; dedicated IPs are optional.
Good at: low cost at volume, reputation metrics, suppression of addresses that bounced or complained, and publishing events to other AWS services.
Lacks: hand-holding. New accounts start in a sandbox and you request production access. Templates, dashboards and list tools are minimal. If bounce or complaint rates run high, AWS can put your account under review or pause sending.
Suits: developers who are fine wiring events into their own code.
Mailgun
Mailgun is a developer-focused sending API with SMTP, webhooks and logs, and it offers shared and dedicated IPs.
Good at: a clear API, inbound routing, event webhooks and searchable logs.
Lacks: not necessarily the lowest price at very high volume. Plan structure has changed over time, so check what is current before you budget.
Suits: product teams who want to start sending quickly.
SendGrid
SendGrid, part of Twilio, covers transactional mail and a marketing product, with shared and dedicated IP options.
Good at: transactional and campaign tooling at one vendor, and broad integration support.
Lacks: immunity from shared-pool effects. On a shared IP, other customers' behavior can touch your delivery. A dedicated IP removes that, but the reputation becomes yours to build. Verify current tiers before choosing.
Suits: teams who want one vendor for app mail and newsletters.
What self-hosting does not fix
Self-hosting does not solve deliverability. Four things stay with you.
IP reputation
Mailbox providers score a sending IP and domain over time. A new self-hosted IP starts with no record, and you build one by sending small, wanted, consistent volume. Managed vendors offer a shared pool with history, or a dedicated IP you still have to build; self-hosting is always the second case. Our guide to warming up a new email domain covers the ramp, and the dedicated IP glossary entry explains the trade-off.
Port 25 and reverse DNS
Many cloud and VPS providers block outbound port 25 by default, and some require a support request to lift it. Your IP also needs a PTR record that matches the hostname your server announces. Check both with your host before you build anything.
Check port 25 first
If your host will not open outbound port 25 or let you set a PTR record, stop there. Nothing else in a self-hosted setup works until both are sorted.
Blacklists
A self-run IP can land on a blacklist quickly, and the cause may be a previous tenant of the address. Check the IP before sending from it, and keep checking. Delisting is a request you make to each list operator.
Bounce and complaint handling
Sending to dead addresses is how reputation drops fastest. Whatever you run must parse hard bounces and complaints and feed a suppression list; our suppression list guide explains what good looks like. If a self-hosted tool does not do it, you are writing it.
Authentication is also yours. Publish SPF, DKIM and DMARC for the sending domain; the SPF generator and DMARC generator produce the records, and our setup guide walks through them. Gmail and Yahoo also expect one-click unsubscribe on bulk mail, however you send.
| Concern | Self-hosted | Managed vendor |
|---|---|---|
| IP reputation | Built from zero by you | Shared pool with history, or a dedicated IP you build |
| Port 25 and PTR | Your host, your request | Handled for you |
| Blacklist monitoring | You | Mostly the vendor |
| Bounce suppression | Check the software; otherwise you write it | Built in |
| Data location | You choose | Vendor's regions |
mailcow versus a relay
Several comments mixed these up. mailcow is a mail server suite: mailboxes, IMAP, webmail, spam filtering. It exists so people can have email accounts. A relay or email API exists so an application can send mail by HTTP call or SMTP and get delivery events back.
If you need mailboxes for humans, you want mailcow or something like it. If your app sends receipts and password resets, you want a relay. Pointing application mail at a mailbox server works for tiny volume, but you lose queueing, events and suppression.
How to choose
Pick a self-hosted API (Hyvor Relay or Postal) if:
- You already run servers and are happy to run another service.
- Data location or full control of the pipeline is a hard requirement.
- Your volume is steady and modest, so one IP's reputation is manageable.
- The project answers the questions above to your satisfaction.
Pick SES, Mailgun or SendGrid if:
- Delivery to Gmail and Outlook matters more than where the software runs.
- You do not want to own blacklist monitoring, PTR records and port 25 negotiations.
- Your volume is bursty or growing, and you would rather rent established IPs.
A middle path: run self-hosted software for your own queue and logs, but send through SES or another provider's SMTP as the upstream relay, so you borrow someone else's IP reputation. Confirm the software supports an upstream relay first.
Moving without losing anything
-
Export your suppression list first. Bounced and complained addresses must follow you; mailing them from a new IP undoes your reputation work before it starts.
-
Set up authentication on a subdomain. Use something like
mail.example.comso the old path keeps working. A starting SPF record, with your own IP in place of the documentation address:mail.example.com. IN TXT "v=spf1 ip4:203.0.113.10 -all" -
Publish DKIM and DMARC for the subdomain, and set the PTR record at your host.
-
Move traffic in slices. Start with your most engaged recipients and low-stakes mail, then raise volume over several weeks while watching Google Postmaster Tools; see our Postmaster Tools guide.
-
Keep the old provider live until the new path has handled a few weeks of normal traffic cleanly. When a message looks wrong, the email header analyzer shows what the receiving server saw.
Use a subdomain
Sending from a dedicated subdomain keeps your main domain's reputation safe while the new IP is unproven.
Checklist before you switch
- Outbound port 25 is open and tested from the server.
- The PTR record matches the hostname the server announces.
- The IP is clear on the major blacklists.
- SPF, DKIM and DMARC are published for the sending subdomain.
- Hard bounces and complaints feed a suppression list.
- Your old suppression list is imported.
- You have a ramp plan and a way to watch complaint rates.
Should you switch at all?
If SES, Mailgun or SendGrid works for you, probably not. The managed vendors sell reputation, abuse handling and operations experience, the hard parts of email. Self-hosting is a fair choice when control, data location or cost structure is the real constraint and you accept the work.
It is a poor choice when the motive is deliverability trouble with your current provider, because a new IP of your own usually starts worse. Look at the cause first: list quality, authentication or complaint rate. Our email deliverability issues guide is a good place to start.
If something goes wrong
If mail from a self-hosted setup is rejected or blocked, contact your hosting provider about port 25 or PTR issues, and the operator of the specific blacklist for delistings. For software behavior, use the project's issue tracker. Include the exact bounce text, timestamps, the sending IP, and the message headers.
Subject: Delivery failures from {your-ip}
Since {date} mail sent from {your-ip} (hostname {your-hostname}) is being
rejected by {receiving-provider} with: "{exact bounce text}".
SPF, DKIM and DMARC pass for {your-domain}. The PTR record is set to
{your-hostname}. Please confirm the IP's status and the steps to resolve it.
Sample headers are attached.
Common questions
Is a self-hosted email API cheaper than SES?
Software cost can be lower, but you pay in server time, IP management and monitoring. SES is hard to beat on raw per-message cost, so compare current pricing with your own hours included.
Does a self-hosted relay avoid blacklists?
No. A new IP can be listed quickly, sometimes because of a previous tenant, so check it before sending and monitor it afterward.
Can I self-host and still use SES?
Often yes, if the software supports an upstream SMTP relay. You keep your own queue and logs while borrowing the provider's IP reputation. Confirm support in the project's docs first.
Is mailcow a replacement for an email API?
No. mailcow hosts mailboxes for people; an email API or relay sends application mail and reports delivery events.
Explore: Email Marketing Strategy
Related Articles
SES sandbox request denied: get production access or switch
If AWS denied your SES production access request with a vague "security reasons" reply, answer the same support case with specifics: where addresses come from, how bounces and complaints are handled, and how people opt out. If it is denied again, Mailgun, Postmark and Resend are the usual alternatives.
ACS Email retirement: alternatives for sending email from Azure
If you send from Azure through Azure Communication Services Email and it is being retired, you can move to SendGrid, Mailgun, Brevo, SocketLabs or Microsoft Graph. Keep the provider key in Key Vault, publish new DNS records before cutover, and shift traffic in stages while you watch bounces.
Hetzner mail all going to spam: alternatives with SMTP and Mailgun
If all mail from your Hetzner web package lands in spam, the shared IP's reputation is often the cause, and hundreds of mails from a small mail server rarely work even on a clean IP. Check the IP first, then move bulk and automated sending to a service such as Mailgun, Brevo, Amazon SES or Postmark.
Cheaper Mailchimp Alternative: Keep Lists, Send via SES
Mailchimp won't send through your own SES or SMTP account, so a hybrid means keeping lists in one place and sending from another. Merge duplicate audiences first. If the bill is still too high, move lists to a tool that sends through SES or Mailgun, and keep transactional mail off marketing tools.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free