Overview
Discover what makes Stalwart Mail Server powerful
**Stalwart Mail Server** is a self‑hosted, full‑stack communication platform written in Rust. It bundles a high‑performance SMTP engine, a JMAP/IMAP/POP3 mail layer, and full CalDAV/CardDAV/WebDAV support into a single binary. The core objective is to deliver a secure, scalable mail & collaboration stack that can be deployed in both small‑scale environments and large, distributed data centers.
JMAP
IMAP
SMTP
CalDAV/CardDAV/WebDAV
Overview
Stalwart Mail Server is a self‑hosted, full‑stack communication platform written in Rust. It bundles a high‑performance SMTP engine, a JMAP/IMAP/POP3 mail layer, and full CalDAV/CardDAV/WebDAV support into a single binary. The core objective is to deliver a secure, scalable mail & collaboration stack that can be deployed in both small‑scale environments and large, distributed data centers.
Technical Overview
At runtime Stalwart exposes a multi‑protocol front‑end that accepts SMTP, JMAP over HTTP/WebSocket, IMAP4rev1/rev2, POP3, CalDAV, CardDAV, and WebDAV connections. The server parses inbound traffic using async I/O (Tokio runtime), then routes requests to protocol‑specific handlers. All data is persisted in a custom, column‑archetype key/value store that supports ACID guarantees and optional encryption‑at‑rest. The engine’s design allows hot reloading of configuration, enabling dynamic policy changes without downtime.
Architecture
| Layer | Technology | Notes |
|---|---|---|
| Runtime | Rust + Tokio async runtime | Zero‑cost abstractions, memory safety |
| Protocol Engines | Pure Rust implementations of JMAP, IMAP4rev1/2, POP3, SMTP, CalDAV/CardDAV/WebDAV | Full RFC compliance; modular extensions |
| Storage | Embedded key/value store (Stalwart‑DB) with optional external storage backends (S3, Azure Blob, local filesystem) | Supports blob management, quotas, and encrypted blobs |
| Security | DANE/MTA‑STS, DKIM/SPF/DMARC/ARC validation, TLS/TLS‑STL, S/MIME support | Built‑in cryptographic libraries (RustCrypto) |
| Extensibility | Plugin system via dynamic library loading, WebSocket API, RESTful admin endpoints | Developers can add new protocols or modify existing ones without touching the core |
Core Capabilities
- JMAP – Full RFC8621 support, including mail and sieve extensions; WebSocket transport for real‑time sync.
- IMAP – IMAP4rev1/rev2, extensive extensions (SEARCH UTF8, IDLE, XLIST), ManageSieve server.
- SMTP – Authentication (SASL), message authentication (DKIM/SPF/DMARC/ARC), DANE support.
- CalDAV/CardDAV/WebDAV – Calendar and address book storage with ACLs, versioning.
- Administration API – RESTful endpoints for user and domain management; supports dynamic configuration reloads.
- Scripting & Rules – Server‑side scripting in Rust or WebAssembly for custom mail filtering and routing.
Deployment & Infrastructure
Stalwart ships as a single statically linked binary, making it trivial to containerize. Docker images are available on Docker Hub and can be orchestrated with Kubernetes, Docker Compose, or plain systemd. The server is stateless across replicas; session state is stored in the shared database, enabling horizontal scaling behind a load balancer. It supports both single‑node deployments and multi‑replica clusters with automatic failover.
Integration & Extensibility
- Plugin API – Load dynamic libraries that implement protocol handlers or storage adapters.
- Webhooks & Callbacks – Expose events (mail received, rule fired) to external services via HTTP or gRPC.
- Custom Storage – Plug in any object store (S3, GCS, MinIO) for blob persistence; database adapters can target PostgreSQL or SQLite if needed.
- SDKs – While no official SDK exists, the REST API is fully documented; developers can generate clients with OpenAPI tools.
Developer Experience
The project emphasizes clear, RFC‑driven documentation. The docs/ directory contains a developer guide, API reference, and RFC implementation notes. Community support is active on Discord, Mastodon, Twitter, and Reddit. Configuration is YAML‑based with schema validation, allowing editors to catch errors early. The build system (Cargo) enables fast iteration; tests cover 90% of protocol logic.
Use Cases
| Scenario | Why Stalwart? |
|---|---|
| Enterprise mail hub | Zero‑cost, self‑hosted with full DMARC/DMARC enforcement and DANE support. |
| Open‑source collaboration platform | Built‑in CalDAV/CardDAV/WebDAV for calendars, contacts, and file sharing. |
| Email gateway for SaaS | JMAP support enables modern webmail clients; extensible rule engine for custom routing. |
| High‑availability mail service | Stateless architecture, auto‑scaling, and graceful reloads for zero downtime. |
Advantages
- Performance – Rust’s async runtime and low‑level optimizations yield sub‑millisecond latency for small messages.
- Security – Built‑in cryptographic checks, encryption‑at‑rest, and strict RFC compliance reduce attack surface.
- Licensing – AGPL v3 ensures that improvements remain open, encouraging community contributions.
- Unified stack – One binary handles all mail and collaboration protocols, simplifying operations.
- Extensibility – Dynamic plugin loading and WebAssembly support let developers tailor the server to niche requirements.
Stalwart Mail Server offers a modern, high‑performance foundation for developers building secure, scalable email and collaboration services without sacrificing control or extensibility.
Open SourceReady to get started?
Join the community and start self-hosting Stalwart Mail Server today
Related Apps in apis-services
Mastodon
Decentralized, real‑time social networking
Discourse
Open‑source community forum platform with real‑time chat and AI
Rocket.Chat
Secure, open‑source team communication platform
Novu
Unified notification platform for multi‑channel delivery
Mattermost
Secure, self‑hosted team collaboration with chat, voice, and AI
Jitsi Meet
Free, encrypted video conferencing for everyone
Weekly Views
Repository Health
Information
Explore More Apps
Conduit
Lightweight Matrix server for fast, secure chats
Ever Gauzy
All-in-one business management platform for the sharing economy
JARR
Just Another RSS Reader – clustered news aggregation
Django-CRM
Open‑source CRM built on Django for full control and rapid customization
Bencher
Continuous benchmarking to detect performance regressions before they hit production
DSpace
Open source digital repository for academic and research institutions