Hyvor Relay
Self-hosted, open-source email API that automates DNS, manages SMTP delivery, and provides deep observability — replacing SES, Mailgun, and SendGrid with infrastructure you fully own.
Hyvor Relay is an open-source, self-hosted email API designed for developers who need complete control over their transactional and marketing email infrastructure. By combining PHP/Symfony for the API backend, Go for SMTP workers and a built-in DNS server, and SvelteKit for the management console, it replaces commercial services like SES, Mailgun, and SendGrid with a system you deploy and manage yourself.
Unlike typical self-hosted mail tools that require extensive manual DNS configuration, Hyvor Relay includes its own authoritative DNS server. Delegate your domain to the relay instance and DNS records — MX, SPF, DKIM, reverse DNS — are managed automatically. This makes the operational burden of running production email infrastructure significantly lower than alternatives.
The system is built for scale from the ground up. IP addresses are mapped to dedicated queues to isolate sender reputation between transactional and bulk email. Multiple servers can be added horizontally via Docker Swarm, and each server runs a Go worker pool that dynamically reconfigures by pulling state from the Symfony API. Prometheus metrics and Grafana dashboards provide visibility into queue depth, delivery rates, and SMTP performance without external instrumentation.
Hyvor Relay supports multi-tenancy with full project isolation — useful for agencies managing multiple clients or SaaS platforms with distinct product lines. Bounce handling, feedback loop integration, and suppression management are built in, protecting sender reputation automatically. Webhooks deliver real-time event notifications for deliveries, bounces, complaints, and domain verification events.
What You Get
- Email REST API - Send HTML or plain text emails with attachments, CC/BCC, custom headers, and reply-to addresses via an idempotent REST API with per-project API keys.
- Built-in DNS Server - Delegate your sending domain to the relay’s own authoritative DNS server and have MX, SPF, DKIM, and reverse PTR records created and maintained automatically.
- Queue Isolation - Route transactional and bulk emails through separate queues mapped to distinct IP addresses, preventing reputation contamination between email types.
- Email Logs and SMTP Conversations - Inspect full SMTP session transcripts, delivery attempts, response codes, and headers for every send — retained for 30 days for debugging and compliance.
- Bounce and Suppression Management - Detect hard and soft bounces automatically, integrate with ISP feedback loops for spam complaints, and maintain suppression lists to protect deliverability.
- Webhooks for Email Events - Receive real-time HTTP callbacks for delivery confirmations, bounces, spam complaints, domain verification changes, and unsubscribes.
- Prometheus Metrics and Grafana Dashboards - Native instrumentation in both the PHP backend and Go worker exposes queue sizes, delivery durations, worker counts, SMTP attempt totals, and PostgreSQL connection stats.
- Multi-Tenancy with Project Isolation - Run multiple tenants and projects from a single deployment, each with independent domains, API keys, webhook configs, and send quotas.
- Horizontal Scaling via Docker Swarm - Add servers and IP addresses to the pool at runtime; Go workers reconfigure dynamically by pulling state from the Symfony API without downtime.
- Health Checks and Alerts - Continuous monitoring of DNS correctness, IP reputation signals, TLS certificate validity, and server connectivity with automated alerts on failure.
Common Use Cases
- SaaS platform transactional email - A SaaS company routes password resets, account notifications, and billing alerts through Hyvor Relay to avoid vendor lock-in, control data residency, and eliminate per-email pricing.
- Agency managing email for multiple clients - A digital agency deploys Hyvor Relay with separate tenants per client, each with their own sending domains and API keys, while sharing a single managed infrastructure instance.
- High-volume marketing campaigns with reputation isolation - An e-commerce brand uses dedicated IPs per queue to ensure a spike in bulk promotional sends cannot affect inbox placement for transactional receipts and order confirmations.
- Data-sovereignty-constrained organizations - A healthcare or finance company deploys Hyvor Relay on-premises to keep email content and metadata inside their own network perimeter, satisfying internal security and regulatory requirements.
- Developer tools and open-source projects - A developer tool ships Hyvor Relay as a recommended email backend, giving users a self-contained way to handle outbound notifications without a third-party account.
- Replacing a legacy mail server - An organization migrates off a manually managed Postfix or Exim setup to get modern API access, observability, and bounce handling without rebuilding custom integrations.
Under The Hood
Architecture Hyvor Relay employs a deliberate polyglot architecture where three separate services communicate across well-defined boundaries rather than sharing code. The Symfony PHP backend acts as the system of record for configuration, projects, domains, and queue state; the Go worker binary polls this API on startup and whenever state changes, then manages goroutine pools for SMTP delivery, DNS resolution, webhook dispatch, and incoming mail handling. This division means the I/O-bound email delivery path runs in Go with lightweight goroutines, while business logic validation and persistence remain in Symfony with its mature ORM and serialization tooling. Traefik acts as the ingress layer, routing by host and path prefix so that the frontend and backend API are decoupled at the network boundary without requiring any code-level coupling.
Tech Stack The backend is PHP 8.4 on Symfony 7.4, running on FrankenPHP which embeds Caddy as the HTTP server and enables persistent worker mode for performance. Doctrine ORM manages PostgreSQL persistence, and Symfony Messenger uses a PostgreSQL-backed queue transport to drive email dispatch without an additional queue broker. The Go worker uses the emersion/go-smtp and miekg/dns libraries to implement a full SMTP relay and authoritative DNS server in a single compiled binary. The SvelteKit 2 frontend is built with TypeScript and the Hyvor Design System component library, compiled to a static build and served directly from the PHP container in production. Both the PHP and Go components expose Prometheus metrics that aggregate into Grafana dashboards.
Code Quality PHPStan runs at its maximum strictness level in CI, enforcing full type coverage across the entire Symfony codebase including Doctrine entities, service constructors, and request input DTOs. Go tests use testify with function-variable injection to mock external dependencies like sendEmailToHost without framework overhead. The PHP test suite uses PHPUnit with a factory pattern for test data, and test modules mirror the application service structure. GitHub Actions CI runs frontend type checking via svelte-check, PHPStan static analysis, and Go tests on every pull request. Error handling is explicit throughout: PHP uses typed exception classes caught by a centralized ExceptionListener that returns structured JSON responses, while Go propagates errors via return values with structured slog logging.
What Makes It Unique The embedded authoritative DNS server is the most operationally significant differentiator. Most self-hosted email tools require users to configure DNS records in their registrar or a separate DNS provider, and keeping those records synchronized as IP addresses change is error-prone. Hyvor Relay’s Go worker includes a full DNS server built on miekg/dns that serves MX, SPF, DKIM, and PTR records directly, so users need only change their domain’s NS records once. The state-driven worker architecture — where Go workers call back to Symfony to receive their configuration, IP assignments, and queue mappings — means horizontal scaling and IP rotation happen without redeployment. This combination of self-contained DNS, dynamic worker reconfiguration, and per-IP queue isolation is not found in comparable open-source email tools.
Self-Hosting
Hyvor Relay is released under the GNU Affero General Public License version 3 (AGPL-3.0). This is a strong copyleft license: you can use, modify, and distribute the software freely, but if you run a modified version as a network service — including internally within your organization — you are required to make your modifications available to users of that service under the same license. For most self-hosters who deploy the software as-is without modifications, this imposes no practical restriction. Organizations that need to keep their modifications private, or that require a commercial license for contractual or legal reasons, can obtain an enterprise license directly from Hyvor.
Running Hyvor Relay yourself requires a PostgreSQL database, one or more servers with dedicated IP addresses suitable for sending email, and the ability to delegate DNS for your sending domains to the relay instance. The Docker-based deployment covers most of the setup, but operational responsibilities include managing TLS certificates for SMTP (the system handles this with auto-renewal), monitoring IP reputation via the built-in health checks and Prometheus dashboards, and responding to alerts when DNS errors or IP blocks are detected. Upgrades are done by pulling a new Docker image and redeploying — the system uses database migrations via Doctrine. There is no managed upgrade tooling, so teams need a process for rolling updates, especially when running multi-server Swarm deployments.
The managed cloud offering at relay.hyvor.com handles IP pool management, DNS delegation, TLS, monitoring, and scaling automatically. It also receives features before they are stabilized and released to the self-hosted version — some release tags in the repository are explicitly marked as cloud-only. Self-hosted users do not get SLAs, managed IP reputation services, or proactive ISP relationship management, which are significant considerations at high sending volumes. Community support is available via the Hyvor Community forum and Discord; commercial support and SLAs require an enterprise agreement.
Related Apps
Ollama
AI Development · Developer Tools
Run Llama, Gemma, DeepSeek, and other open LLMs on your own machine with one command and an OpenAI-compatible API.
Ollama
MITLangflow
AI Agents · AI Development
Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.
Langflow
MITDify
No Code Platforms · AI Development · Developer Tools
Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.