ScriptsApr 24, 2026·3 min read

Mailu — Docker-Based Self-Hosted Mail Server

Mailu is a full-featured, Docker-based mail server suite that bundles SMTP, IMAP, webmail, antispam, antivirus, and an admin UI into a set of coordinated containers for easy deployment and management.

Introduction

Mailu packages every component of a production mail server into Docker containers that work together out of the box. Rather than manually configuring Postfix, Dovecot, and a dozen related services, Mailu provides an opinionated, container-native stack with a web-based setup wizard and admin panel. It targets small to medium deployments where simplicity and security matter more than extreme customization.

What Mailu Does

  • Runs Postfix (SMTP) and Dovecot (IMAP/POP3) in isolated containers with automatic TLS via Let's Encrypt
  • Includes Rspamd for spam filtering with Bayesian learning and optional ClamAV for virus scanning
  • Provides Roundcube or Rainloop as webmail clients accessible from the browser
  • Offers a web admin panel for managing domains, users, aliases, and relays
  • Handles DKIM signing, SPF, DMARC, and autoconfig/autodiscover for email clients

Architecture Overview

Mailu uses Docker Compose to orchestrate a set of microservice containers. The front container (Nginx) handles TLS termination, HTTP routing, and SMTP/IMAP proxying. Behind it, dedicated containers run Postfix, Dovecot, Rspamd, an optional antivirus (ClamAV), the admin interface (Flask-based), and the chosen webmail. A Redis instance coordinates rate limiting and Rspamd state. All persistent data lives in Docker volumes, making backups straightforward.

Self-Hosting & Configuration

  • Use the online setup wizard at setup.mailu.io to generate a docker-compose.yml tailored to your domain
  • Requires a server with at least 2 GB RAM (4 GB if enabling ClamAV) and ports 25, 143, 443 open
  • Configure DNS records (MX, SPF, DKIM, DMARC) as shown in the admin panel's DNS status page
  • Environment variables in mailu.env control all settings: domain, TLS mode, message size limits, and features
  • Update by pulling new images and running docker compose up -d; data volumes are preserved

Key Features

  • Container-native architecture with each service isolated in its own Docker container
  • Web-based setup wizard that generates a ready-to-run Compose file for your configuration
  • Rspamd integration with auto-learning, greylisting, and DKIM/ARC signing
  • Multi-domain support with per-domain quotas, aliases, and catch-all addresses
  • Fetchmail integration to pull messages from external accounts into local mailboxes

Comparison with Similar Tools

  • Mail-in-a-Box — Single-server Bash installer; simpler but less modular than Mailu's container approach
  • Mailcow — Docker-based like Mailu but uses SOGo for groupware; heavier resource footprint
  • iRedMail — Script-based installer for bare-metal; more flexible OS support but no container isolation
  • Docker Mailserver — Minimal single-container mail setup; lighter but lacks Mailu's admin UI and wizard

FAQ

Q: How much RAM does Mailu need? A: A basic setup runs on 2 GB. Enabling ClamAV antivirus adds roughly 1-2 GB of memory usage.

Q: Can I use Mailu with an existing reverse proxy? A: Yes. Mailu supports running behind Traefik, Nginx, or Caddy by configuring the TLS_FLAVOR and proxy settings in mailu.env.

Q: Does Mailu support two-factor authentication? A: The admin panel supports 2FA for admin accounts. Webmail 2FA depends on the chosen webmail client.

Q: How do I migrate from another mail server? A: Use imapsync or the Fetchmail feature to pull existing messages from your old IMAP server into Mailu mailboxes.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets