Mailezine Engine
The in-house engine powering every mailez edition: a single binary with pluggable storage, replacing the classic Postfix + Dovecot stack with built-in Rspamd integration.
Why Mailezine?
Traditional mail systems are assembled from many independent components — complex to operate and hard to debug. Mailezine redefines the mail engine as a single binary, and now powers every mailez edition.
Traditional (Postfix + Dovecot)
- ❌ 5+ components you install, wire up and tune yourself (Postfix, Dovecot, Rspamd, Unbound, nginx)
- ❌ Components talk over sockets/pipes — hard to debug
- ❌ Config scattered across files with different formats
- ❌ Depends on system package management; upgrade risk
- ❌ Linux only; Windows development needs WSL
- ❌ Storage bound to Maildir — no choice
Mailezine
- ✅ Single binary for the mail core — SMTP, IMAP, ManageSieve, queue and DKIM signing; spam filtering comes pre-wired through Rspamd
- ✅ In-process calls, zero IPC overhead
- ✅ Unified config: environment variables + YAML
- ✅ Statically compiled, cross-platform deployment
- ✅ Native Linux / macOS / Windows support
- ✅ Pluggable storage (Pebble / TiDB, bodies on S3 object storage)
Core Features
Single-binary deployment
One executable carries the mail core — SMTP, IMAP, ManageSieve, queue and DKIM signing. No dependencies, no package manager — copy and run.
Pluggable storage
Multiple storage backends to choose from: TiDB (distributed KV, the production default for horizontal scaling) and Pebble (pure-Go LSM, default for local development); message bodies can live in local FS or MinIO/S3 object storage. Same code, same tests.
Complete protocols
Full SMTP send/receive, Submission, IMAP, POP3 and ManageSieve support — production-proven protocol implementations.
Pre-integrated anti-spam
Seamless Rspamd scanning (wired into the compose stack by default) with DKIM/DMARC verification; outbound mail is signed automatically, inbound mail verified.
Zero IPC overhead
Where Postfix and Dovecot communicate over sockets, Mailezine does everything in-process. Lower latency, higher throughput.
Native cross-platform
Statically compiled Go runs natively on Linux / macOS / Windows. No WSL, no VMs — a consistent development experience.
Object storage
Message bodies can be stored on S3/MinIO for large-scale deployments; metadata lands on TiDB KV or Pebble. Local FS and cloud storage switch through one unified interface with zero code changes.
Full-text search
Embedded FTS index (bleve), with optional Tika extraction of PDF / Office / ODF attachments — attachment text is searchable too.
HA & horizontal scaling
Active-passive lease failover with automatic takeover; on TiDB + S3, instances scale horizontally and capacity and throughput grow linearly with the storage layer.
End-to-end tests
Complete e2e coverage: SMTP→storage, SMTP→IMAP, relay enqueue, Sieve→Junk. Every commit verified automatically.
Measured benchmark: Mailezine vs the traditional mail stack
10,000-user enterprise load, same machine, same load tool — an A/B comparison of both stacks.
| Metric | Traditional stack (Postfix + Dovecot) | Mailezine | Gain | What it means |
|---|---|---|---|---|
| Inbound throughput | 3.1 msg/s | 13.6 msg/s | 4.4× | 3.4× more mail per second on the same hardware |
| Inbound p50 | 6.19 s | 1.35 s | 4.6× | New mail arrives near-instantly |
| Submission throughput | 2.2 msg/s | 6.8 msg/s | 3.1× | Bulk outbound queues drain comfortably |
| IMAP FETCH p50 | 35.97 ms | 20.96 ms | 1.7× | Snappier reads; long lists scroll smoothly |
| Queue delivery | 2.1 msg/s | 7.2 msg/s | 3.4× | Fewer bounces and delayed deliveries |
| Enqueue→delivery p50 | 35.6 s | 5.30 s | 6.7× | Nearly seven times faster end-to-end delivery |
| Queue backlog | 122 msgs | 0 msgs | zero | Zero backlog under load |
| Idle memory | ~162 MiB | ~6.4 MiB | 1/25 | Runs comfortably on small hosts |
| Load memory | ~270 MiB | ~73 MiB | 1/3.7 | Memory stays flat through mail floods |
Architecture
Protocol layer
Processing layer
Storage layer
Quick Start
# Standalone dev mode
export MAILEZINE_DIRECTORY_FILE="internal/directory/testdata/dev-directory.json"
export MAILEZINE_AUTH_DEV_FILE="internal/auth/testdata/dev-passwords.json"
# Start the engine
go run ./cmd/mailezine
# Verify
curl http://127.0.0.1:11480/health
# End-to-end tests
go test ./cmd/mailezine -run TestEndToEnd -vStorage Backend Comparison
TiDB
Distributed KV, the Enterprise default backend
- MySQL protocol compatible
- Multi-replica high availability
- Capacity and throughput scale horizontally
- One-way migration from traditional Maildir supported
Pebble
Pure-Go LSM KV, Community / local-dev default
- Pure-Go implementation, no CGO dependency
- Cross-platform support
- Lightweight, zero external dependencies
- Ideal for small and mid-size deployments
S3 object storage
Blob layer for message bodies
- Bodies stored as blobs, metadata in KV
- Local FS, MinIO or any S3-compatible service
- Elastic storage that grows with your data
- Suitable for large-scale deployments
The engine behind mailez
Mailezine powers every mailez edition, with the full SMTP / IMAP / POP3 / ManageSieve pipeline verified across two counter-balanced benchmark rounds. Community and Enterprise run the same engine — single-node and free, or distributed with enterprise features, with a smooth upgrade in between.