Mailu: A Mail Server in a Container (Seriously, It’s That Simple)
Introduction
Okay, so here’s the deal—mail servers usually feel like medieval torture devices, right? Endless config files, weird dependencies, and did I mention the part where you pray your SSL cert doesn’t expire at midnight? Enter Mailu. It’s basically a Docker Compose recipe for your mail stack: Postfix, Dovecot, Rspamd, webmail—everything lives in neat little containers. You clone a repo, tweak a `.env` file (you know, set your domain, admin password…), and—poof—your mail is alive. No more “Well, it worked on my laptop” headaches.
Overview
Under the hood, Mailu glues together proven tools: Postfix handles SMTP, Dovecot brings IMAP/POP3 to the table, Rspamd fights spam, and you get to pick Roundcube or RainLoop for webmail. All the while, Let’s Encrypt keeps TLS certificates fresh (you barely lift a finger). Mailboxes live in Maildir format—file per message—so backups are just “copy this folder,” and scaling? Spin up another container behind your load-balancer and you’re golden.
Key Characteristics
Feature | Why It’s Actually Cool |
All-in-One Containers | No more “Which version of XYZ did I install?”—everything’s defined in Compose. |
Modular Extras | Want antivirus? Toss in the ClamAV container. Need a calmer spam filter? Rspamd’s got you. |
Admin UI | A surprisingly slick interface to manage domains, users and aliases—right in your browser. |
Auto TLS | Let’s Encrypt integration means certificates renew themselves—sleep tight. |
Maildir Storage | Each email is a file—backups = folder copies. Restore by copying back. |
Flexible Backends | Store user data in SQLite, MariaDB or Redis—pick your poison. |
Pick Your Webmail | Roundcube or RainLoop? Your call—no extra installs required. |
Scale on Demand | Need more capacity? Fire up extra containers, point your load-balancer, done. |
Quickstart
- Clone & Configure:
“`bash
git clone https://github.com/Mailu/Mailu.git /opt/mailu
cd /opt/mailu
cp .env.sample .env
# Edit .env: set DOMAIN, HOSTNAMES, ADMIN user/password, WEBMAIL choice…
“` - Launch the Stack:
“`bash
docker-compose up -d
# then: docker-compose logs -f admin
“` - Use the Interface:
Open https://mail.yourdomain.com/, log in as ADMIN, add domains, mailboxes and aliases. - Test Mail:
Send an email from Gmail or Outlook, watch it land—TLS-secured, spam-filtered, everything.
Pro Tips
– Volume Mapping: Mount host directories for `maildata/`, `redis/`, `db/`—keeps data safe if you upgrade images.
– Backups: Dump your database (or copy `maildata/`) regularly; trust me, you’ll thank yourself.
– Resource Caps: Docker’s CPU and memory limits can keep Rspamd from eating your server alive.
– Monitoring: Toss in Prometheus exporter and Grafana dashboard—watch your queues, spam rates, TLS renewals.
– Custom Tweaks: Need special Postfix rules? Drop override files into `overrides/postfix/` and reboot containers.
Closing Thought
Honestly, Mailu turns the usual mail-server hell into a one-folder, one-command affair. If you already speak Docker, it’s like ordering pizza—clone, configure, serve. Mail, done.