MCPSERV.CLUB
Mailu

Mailu

Self-Hosted

Docker‑based, feature‑rich mail server for self‑hosters

Active(95)
6.9kstars
1views
Updated 4 days ago
Mailu screenshot

Overview

Discover what makes Mailu powerful

Mailu is a modular, Docker‑centric mail stack that bundles all the core services required for a production‑ready email domain—SMTP, IMAP/IMAPS, webmail frontends, and an administrative UI—into a set of lightweight images. From a developer standpoint it functions as a *platform* rather than a monolithic appliance: each component (Postfix, Dovecot, nginx, Rspamd, SpamAssassin, clamav, etc.) runs in its own container and communicates over a private Docker network. This separation simplifies debugging, allows selective scaling (e.g., spinning up more Dovecot workers for high‑volume mailboxes), and aligns with modern infrastructure patterns such as Kubernetes or Docker Swarm.

Languages & Frameworks

Mail Transfer & Delivery

Security & Spam

Search & Indexing

Overview

Mailu is a modular, Docker‑centric mail stack that bundles all the core services required for a production‑ready email domain—SMTP, IMAP/IMAPS, webmail frontends, and an administrative UI—into a set of lightweight images. From a developer standpoint it functions as a platform rather than a monolithic appliance: each component (Postfix, Dovecot, nginx, Rspamd, SpamAssassin, clamav, etc.) runs in its own container and communicates over a private Docker network. This separation simplifies debugging, allows selective scaling (e.g., spinning up more Dovecot workers for high‑volume mailboxes), and aligns with modern infrastructure patterns such as Kubernetes or Docker Swarm.

Technical Stack

  • Languages & Frameworks: The control plane is written in Python 3, leveraging Flask for the web administration interface and the mailu CLI tool. The configuration engine uses Jinja2 templates to generate service configs from a single mailu.yml file.
  • Mail Transfer & Delivery: Postfix serves as the MTA, configured via generated main.cf and master.cf. Dovecot handles IMAP/IMAPS, with optional imap+ support for mailbox extensions.
  • Security & Spam: Rspamd (Rust) provides anti‑spam scoring, while ClamAV and Snuffleupagus (PHP sandboxing tool) guard against malware. TLS is enforced by default, with support for Let's Encrypt ACME, DANE, and MTA‑STS.
  • Search & Indexing: A full‑text search engine (Elasticsearch or Meilisearch) indexes email bodies and attachments, exposing a REST API that can be queried by third‑party services.
  • Databases: User accounts, domain settings, and policy rules are stored in a PostgreSQL instance, accessed via SQLAlchemy from the Python backend.

Core Capabilities

  • Auto‑configuration Profiles: Generates O365, Apple, and Thunderbird configuration files on the fly for any registered domain.
  • Domain & Alias Management: Supports nested domain aliases, custom routing rules, and per‑user aliasing through the REST API.
  • Webmail & Admin UI: Multiple webmail clients (Roundcube, Horde) are pre‑configured; the admin panel exposes CRUD operations for users, domains, and quotas.
  • API & Webhooks: Exposes a JSON‑based API for creating users, managing aliases, and fetching delivery statistics. Webhooks can be attached to events such as message rejection or spam detection for external monitoring.

Deployment & Infrastructure

Mailu’s Docker images are built on Alpine Linux, keeping the attack surface minimal and the image size below 200 MB per service. The official Docker Compose file demonstrates a fully functional stack, but the architecture is designed for container orchestration: each service can be declared as a Deployment or StatefulSet in Kubernetes, with persistent volumes for mail storage and PostgreSQL data. Horizontal Pod Autoscaling can target Dovecot or Postfix based on CPU/memory metrics, enabling elastic scaling for high‑traffic domains.

Integration & Extensibility

  • Plugin Hooks: The Python backend exposes hooks for custom authentication backends (OAuth2, LDAP) and mail routing logic.
  • Extensible Filters: Users can inject custom Rspamd modules or ClamAV signatures via mounted config directories.
  • External APIs: The search index can be queried by external applications (e.g., a corporate knowledge base) to surface relevant emails.
  • Webhook Support: Post‑delivery or spam events can trigger HTTP callbacks, allowing integration with incident‑response platforms.

Developer Experience

The configuration model—single YAML file plus optional environment variables—reduces cognitive load compared to legacy mail servers. Documentation is comprehensive, with a dedicated “Deployment” section that covers CI/CD pipelines and Kubernetes manifests. The active community on Matrix and GitHub ensures rapid issue triage, while the MIT license guarantees freedom to modify or embed Mailu in proprietary stacks without licensing overhead.

Use Cases

  1. Enterprise Private Email – Organizations needing a self‑hosted, GDPR‑compliant mail solution can spin up Mailu on their private cloud and expose only the required ports.
  2. Service Providers – Hosting companies can offer per‑domain mail services by templating the mailu.yml for each customer, leveraging Docker Swarm or Kubernetes to isolate tenants.
  3. Developer Sandboxes – Rapidly deploy a full mail stack in CI pipelines to test email delivery, DKIM/SPF configurations, or spam filtering logic.
  4. Academic Projects – Research groups can experiment with mail routing algorithms or new anti‑spam techniques by plugging custom modules into the Rspamd pipeline.

Advantages

  • Modularity & Scalability: Each service runs in its own container, making it trivial to scale or replace components (e.g., swap Postfix for Exim).
  • Security‑First Design: Mandatory TLS, DANE, and sandboxed PHP (Snuffleupagus) provide a hardened baseline out of the box.
  • Open Source & License Freedom: MIT license removes licensing costs and allows proprietary integration without legal risk.
  • Developer‑Friendly APIs: REST endpoints for user and domain management, plus webhooks, enable automation and integration with existing tooling.
  • Active Community & Documentation: Regular updates, a responsive issue tracker, and detailed docs lower

Open SourceReady to get started?

Join the community and start self-hosting Mailu today