BillionMail
Self-hosted email server and marketing platform that gives you unlimited sending, full deliverability control, and AI-assisted campaigns without monthly fees.
BillionMail is an open-source, self-hosted email server and email marketing platform that combines a complete mail infrastructure stack with campaign management and real-time analytics. Built around industry-standard components — Postfix for SMTP, Dovecot for IMAP/POP3, and Rspamd for spam filtering — it gives teams full sovereignty over their email infrastructure while eliminating recurring SaaS fees.
The platform handles everything from domain configuration and DNS record verification to SSL provisioning, DKIM signing, and blacklist monitoring in a unified interface. Campaigns are built using a template editor with Spintax support for dynamic content variation, contact groups with tag-based segmentation, and scheduled delivery with open and click tracking.
Beyond standard marketing features, BillionMail includes an AI-assisted email composition module that integrates directly with OpenAI-compatible APIs for generating and refining email content. A video outreach module lets teams create and attach AI-generated video content to campaigns. The entire stack deploys in minutes via a single install script or Docker Compose, and a bm management CLI handles updates, DNS record inspection, and configuration.
Designed for developers, agencies, and bootstrapped businesses, BillionMail eliminates the cost-per-email and data-ownership constraints of hosted platforms like Mailchimp or SendGrid while providing an operational experience comparable to managed services.
What You Get
- Complete mail server stack — Postfix (SMTP), Dovecot (IMAP/POP3), and Rspamd (spam filtering) deployed as hardened Docker containers with shared secrets and volume isolation, ready to receive and send from your own domain.
- Automated SSL and DNS management — Auto-provisions free SSL certificates via go-acme/Let’s Encrypt, generates DKIM keys in 2048-bit or 1024-bit variants, and validates SPF/DKIM/DMARC records directly from the domain settings UI.
- Campaign builder with Spintax support — A template editor with list and tag segmentation, per-campaign tracking toggles for opens and clicks, and a Spintax parser backed by an LRU cache and goroutine pool for high-throughput content variation.
- Real-time deliverability analytics — Dashboard tracking sent volume, delivery rate, open rate, click-through rate, bounce handling, and DSN diagnostics with hourly, daily, and monthly chart granularity.
- Domain blacklist monitoring — Automatic and manual scanning against multiple DNS blacklist providers with email alerting when your sending domain or IP appears on a blocklist.
- AI-powered email composition — Integrated module connecting to OpenAI-compatible APIs (configurable base URL, model ID, token limits) for generating campaign copy, with streaming response rendering and thinking-state visibility.
- Integrated RoundCube webmail — Full webmail access at
/roundcube/included in the stack without a separate installation, sharing the same Dovecot backend. - Management CLI (
bm) — Shell utility for showing DNS records, rotating credentials, triggering updates, and viewing default login info from the server command line.
Common Use Cases
- High-volume cold email outreach — A SaaS growth team uses BillionMail’s unlimited sending and Spintax templates to send 100,000 personalized cold emails monthly, tracking opens and clicks without paying per-email fees to platforms like Instantly or Lemlist.
- Newsletter publishing without SaaS lock-in — An independent journalist migrates from Mailchimp to BillionMail to own their subscriber list, send unlimited issues, and avoid escalating tier pricing as the list grows past 5,000 contacts.
- Agency managing multiple client domains — A digital marketing agency configures separate sending domains for each client on a shared BillionMail instance, using per-domain DKIM keys and contact groups to isolate campaign data.
- Internal transactional email infrastructure — A startup routes all application email — password resets, notifications, receipts — through BillionMail’s SMTP relay instead of paying SendGrid overage charges, using the API to inject messages programmatically.
- Privacy-sensitive organizational mail — A nonprofit hosting sensitive member communications self-hosts BillionMail to ensure no third-party SaaS provider processes their data, using Dovecot IMAP for secure inbox access and Rspamd for filtering.
Under The Hood
Architecture BillionMail follows a layered MVC structure built on the GoFrame v2 framework, with clear boundaries between HTTP controllers, domain service modules, and data access objects backed by PostgreSQL. The application is organized into over twenty domain modules — batch mail, campaigns, contacts, domains, maillog statistics, relay configuration, and AI composition among them — each encapsulating its own controller, service, and model layers with minimal cross-module coupling. Docker Compose orchestrates eight containers (Go backend, Postfix, Dovecot, Rspamd, Redis, PostgreSQL, Roundcube, and PHP-FPM) with explicit network aliases and volume mounts, enabling the entire production stack to be launched from a single compose file. A reverse proxy domain setting allows tracking URLs to be externalized without changing container configuration.
Tech Stack The backend is written in Go 1.24 using GoFrame v2 for routing, ORM, validation, and Redis client management, with the PostgreSQL driver loaded as a contrib plugin. High-throughput campaign delivery uses panjf2000/ants goroutine pool alongside the Spintax template engine with an in-process LRU cache. SSL certificate automation is handled by go-acme/lego with support for Aliyun, Tencent Cloud, Azure, and AWS Route 53 DNS challenge providers. AI composition integrates via the sashabaranov/go-openai client, configurable to any OpenAI-compatible endpoint. The E2E test suite runs Python/pytest against a live containerized stack, while unit tests use testify with table-driven cases.
Code Quality The codebase maintains forty-eight test files covering critical paths: Spintax parser concurrency, template variable rendering, mail tracking encryption and decryption, DNS blacklist validation, JWT authentication, CAPTCHA generation, and mailbox credential hashing. Test patterns are consistent — table-driven cases with testify assertions — and the tracker and spintax modules include dedicated integration tests alongside unit tests. Inline comment density is moderate, with exported functions and structs documented in exported service files. The project lacks a CONTRIBUTING guide but includes a SECURITY policy and reverse proxy documentation. GoFrame’s built-in validation middleware and structured logging are used consistently across controllers, providing observable error paths.
What Makes It Unique BillionMail’s Spintax engine with an LRU-cached parser and ants goroutine pool enables high-throughput content variation at scale without blocking the campaign dispatch loop, which is rare in self-hosted tools. The AI composition module streams OpenAI responses with explicit thinking-state lifecycle tracking, allowing the UI to distinguish reasoning phases from final output — a capability typically found only in dedicated AI writing tools. The video outreach module generates and attaches AI-created video content to email campaigns, combining two normally separate product categories in one self-hosted platform. Domain blacklist scanning is embedded directly in the service layer with configurable alert recipients, so operators get automated abuse monitoring without a third-party uptime service.
Self-Hosting
BillionMail is released under the GNU Affero General Public License v3.0 (AGPLv3). This means you can use, modify, and redistribute the software freely, including for commercial purposes, but if you run a modified version as a network service — even internally — the AGPL requires you to make your modifications available under the same license to users who interact with the service. For most organizations self-hosting their own instance without distributing it to others, the practical constraint is minimal. However, SaaS providers or agencies who intend to white-label or resell BillionMail as a hosted service must release their modifications, which may not be compatible with proprietary business models.
Operating BillionMail yourself means taking full responsibility for the entire mail infrastructure. You need a server with a static IP address, and your IP must not be on major blacklists — a common stumbling block for new sending domains. You are responsible for DNS configuration (SPF, DKIM, DMARC), SSL certificate renewal (automated via go-acme but dependent on DNS challenge API credentials), PostgreSQL and Redis maintenance, Postfix and Dovecot updates, and Rspamd rule updates for spam filtering accuracy. Deliverability warming — gradually increasing sending volume from a new IP — is your responsibility, and poor sending reputation can result in major providers blocking your domain. The bm CLI and Docker Compose simplify day-to-day operations, but a production setup requires Linux administration confidence and ongoing monitoring.
Compared to managed alternatives like Mailchimp, SendGrid, or Postmark, self-hosting BillionMail trades convenience for cost and control. Managed platforms handle deliverability reputation, abuse compliance, bounce processing, and infrastructure scaling automatically, and include support contracts and uptime SLAs. BillionMail provides no managed support tier or SLA, and there is no official cloud-hosted version. For teams with the technical staff to manage a mail server and whose email volume makes per-email pricing prohibitive — or who have data sovereignty requirements — the trade-off is favorable. For teams without dedicated infrastructure ownership, managed platforms remain lower operational risk.
Related Apps
ntfy
Developer Tools · Marketing
Send push notifications to your phone or desktop from any script or service using a single HTTP PUT or POST—no sign-up required.
ntfy
Apache 2.0Dub
Marketing · Analytics
The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.
Dub
Otherlistmonk
Marketing · Blogging
High-performance, self-hosted newsletter and mailing list manager packaged as a single binary with built-in analytics, transactional messaging, and multi-channel delivery.