Video tutorial coming soon.
✉️ Setup Mailu — Simple Email Server
Deploy Mailu, a simple yet full-featured email server suite. Includes webmail, admin interface, spam filtering, and all standard mail protocols — configured via a web setup utility.
📦 Resources & Setup Scripts
Grab the automated bash script from GitHub to follow along.
Quick Install:
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/email/mailu/mailu-ubuntu.sh
chmod +x mailu-ubuntu.sh
sudo bash mailu-ubuntu.sh
Tutorial Steps
1 Download & Run the Script
The script installs Docker, generates the Mailu environment configuration for your domain, and starts the full email server stack.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/email/mailu/mailu-ubuntu.sh
chmod +x mailu-ubuntu.sh
sudo bash mailu-ubuntu.sh
2 Access Admin Panel
Open your browser and navigate to the Mailu admin panel to create your first admin account:
https://YOUR-DOMAIN/admin
3 Configure DNS Records
Add the required DNS records for your domain: MX record pointing to your server, SPF TXT record, DKIM key (found in admin panel), and DMARC policy record.
4 Add Mailboxes and Connect Clients
Create user mailboxes in the admin panel. Users can access their email via the Roundcube webmail at /webmail or configure IMAP/SMTP in any email client.
Ports Used
| Port | Protocol | Purpose |
|---|---|---|
| 25 | TCP | SMTP (Receiving Mail) |
| 143 | TCP | IMAP |
| 80/443 | TCP | Webmail & Admin UI |
| 587 | TCP | SMTP Submission |
| 465 | TCP | SMTPS (SSL) |
| 993 | TCP | IMAPS (SSL) |
Files Location
/root/docker/mailu/docker-compose.yml
Overview
Mailu is a simple, full-featured Docker-based mail server. Like Mailcow, it bundles all mail server components (Postfix, Dovecot, Rainloop webmail, rspamd) into a Docker Compose stack. Mailu is designed to be simpler than Mailcow, with a minimal admin interface and a focus on ease of maintenance over feature richness.
Why Use It
Mailu is the lighter, simpler alternative to Mailcow for self-hosted email. If you need a fully functional mail server — SMTP, IMAP, spam filtering, webmail, and DKIM signing — but want something easier to configure and less RAM-hungry than Mailcow, Mailu is the answer. It bundles everything into a single Docker Compose stack generated by the official setup wizard at setup.mailu.io, making initial configuration straightforward even for those new to mail server administration.
When You Need It
Who Should Use It
Real Use Cases
Main Features
How to Use After Installation
Security Best Practices
Ports and Firewall Notes
Mailu requires ports 25 (SMTP), 587 (submission), 465 (SMTPS), 993 (IMAPS), 995 (POP3S), 80, and 443. The admin panel is served over HTTPS on port 443 (no separate admin port like Mailcow). Port 25 must be unblocked by your VPS provider — contact support if it is blocked. Set up a PTR/rDNS record for your server IP with your provider to avoid delivery rejection.
Backup and Maintenance
Common Mistakes
Troubleshooting
Alternatives
Mailcow is the primary alternative — more feature-rich (SOGo webmail, CalDAV/CardDAV, deeper admin panel) but requires 3+ GB RAM versus Mailu's 1 GB minimum. iRedMail is another Docker-based option with strong documentation. Modoboa is modern and Python-based but has a smaller community. For non-technical users or teams without server administration experience, managed options like Migadu (no per-user pricing), Fastmail, or ProtonMail offer privacy with far less maintenance overhead.
When Not to Use It
Do not use Mailu if your VPS provider blocks port 25 and refuses to unblock it — email delivery is impossible without it. Avoid it if you need advanced features like ActiveSync push email, detailed per-user spam reports, or integrated contact/calendar sync (use Mailcow instead). Do not deploy Mailu if you cannot maintain it — email servers need ongoing attention for IP reputation, security patches, and DNS records. For most small teams, a managed provider is cheaper in total effort than self-hosting email.
Need Help Setting Up Mailu?
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
Frequently Asked Questions
What are the minimum server requirements for Mailu?
Mailu runs on as little as 1 GB RAM for basic use, though 2 GB is recommended for comfortable operation. It requires a dedicated IP address with a matching PTR/rDNS record, a domain with MX, SPF, DKIM, and DMARC records configured, and port 25 unblocked by your VPS provider. Use the setup wizard at setup.mailu.io to generate the correct configuration before deploying.
Why should I use setup.mailu.io instead of editing the config manually?
The Mailu setup wizard generates a validated docker-compose.yml and mailu.env that match the specific version you are deploying. Manually editing these files is error-prone — a single wrong value (wrong hostname, missing variable, incorrect subnet) can break SMTP, IMAP, or TLS. The wizard handles all inter-service dependencies and subnet configuration automatically.
How do I add a new domain to Mailu?
Log in to the admin panel at https://mail.yourdomain.com/admin, go to Mail Domains, and click Add domain. Enter the domain name, generate a DKIM key, and publish the provided TXT record in your DNS. Also add an MX record pointing to your Mailu server and update SPF and DMARC records for the new domain.
Can I use Mailu with an external SMTP relay for better deliverability?
Yes. If your VPS provider blocks port 25 or if your IP has deliverability issues, configure Mailu to relay outbound mail through an SMTP relay service like Mailgun, Postmark, or Amazon SES. Set the RELAYHOST variable in mailu.env to your relay's hostname and authentication credentials. Inbound mail still arrives via your server (MX record), only outbound is relayed.
How do I migrate existing email from Gmail or another provider to Mailu?
Use Mailu's built-in Fetchmail configuration to pull existing messages over IMAP, or use imapsync externally to copy messages from the source server to your Mailu mailboxes. For Gmail, enable IMAP access and create an App Password (required since Google removed basic auth). Run the migration before switching your MX record to minimize disruption.
What webmail client does Mailu include?
Mailu supports Roundcube (default, full-featured) and Rainloop (lighter but less maintained). You select the webmail client in the setup wizard. Roundcube is recommended — it supports IMAP, SMTP, address book, calendar (with the CalDAV plugin), and HTML composition. Access it at https://mail.yourdomain.com.
How do I update Mailu to a new version?
Mailu uses versioned Docker images (e.g., ghcr.io/mailu/admin:2024.06). To update, re-run the setup wizard at setup.mailu.io with the new version number, download the generated files, replace your docker-compose.yml and mailu.env, then run docker compose pull && docker compose up -d. Always back up your data volume before upgrading and read the migration notes for breaking changes.
Is Mailu suitable for a business with 50+ employees?
Mailu works for teams of 50+ on adequate hardware (4+ GB RAM, 4 cores), but it lacks some enterprise features: no built-in ActiveSync push for mobile, no shared calendar server (unless you add Nextcloud), and the admin panel is relatively basic. For larger organizations needing advanced features, Mailcow or a managed service like Google Workspace may be more appropriate. Mailu is best suited for small-to-medium teams comfortable with lightweight tooling.
