Mail-in-a-Box
Turn a fresh server into a working mail server
Mail-in-a-Box is an easy-to-deploy bundle that turns a clean Ubuntu server into a complete mail and web server. It automates DNS, webmail, contacts, calendar, and antispam setup.
Key features
- One-command full mail setup
- Automatic DNS and TLS
- Roundcube webmail and Nextcloud contacts
- Built-in admin dashboard
Pros & cons
Strengths
- Very beginner-friendly
- Opinionated, complete stack
Trade-offs
- Limited customization
- Dedicated server required
Mail-in-a-Box replaces
Last reviewed Aug 26, 2026 · 821 words
Mail-in-a-Box will have a working mail server on a fresh Ubuntu 22.04 machine in about 20 minutes, and none of those minutes are the hard part. The hard part is the provider decision made before the install: outbound port 25 must be open, the IP needs a reverse DNS record you control, and it needs a reputation clean enough that Gmail and Microsoft accept mail from it. Get those three right and this is the most beginner-friendly way to run your own mail; get them wrong and no software will save you.
One command, one box, the whole stack
The install is a single line run on a clean server:
curl -s https://mailinabox.email/setup.sh | sudo -E bash
Twenty minutes later you have Postfix and Dovecot for SMTP and IMAP, Roundcube webmail, Nextcloud for contacts and calendar sync, Z-Push for phones that speak ActiveSync, SpamAssassin, greylisting, fail2ban, Let's Encrypt certificates, and an admin panel at https://box.example.com/admin where users, aliases and domains are managed. DKIM, SPF and DMARC records are generated for you, and the box runs its own authoritative DNS server so those records are correct by construction rather than pasted into a registrar by hand. The design goal, stated by the project since 2014, is that a person who has never run a mail server can do this. It succeeds.
The box wants to own the machine and the DNS
Opinionated means opinionated. Mail-in-a-Box expects a dedicated server with nothing else on it, and its update mechanism reruns the setup script, overwriting hand edits to Postfix or nginx configuration on every upgrade. It also wants to be the nameserver for your domain: you register ns1.box.example.com and ns2.box.example.com as glue records at your registrar and let the box serve DNS. You can run external DNS instead by copying the records it shows you, but every added feature becomes a manual step. If you already have a Docker host doing 15 things, this is not the tool; it wants a small VPS of its own, with 1 GB of RAM as the floor and 2 GB more comfortable once SpamAssassin and Nextcloud are both resident.
Your VPS choice matters more than the software
Most large cloud providers block outbound port 25 on new accounts and unblock it only on request, and some never do. Before spending a minute on the install, check three things with the provider: port 25 outbound is open, you can set the PTR record on the IP to box.example.com, and the IP is not on a blocklist (the box's own status checks will tell you after setup, and mxtoolbox before it). Smaller providers with a mail-friendly policy are worth the extra 2 or 3 dollars a month. Then plan for the slow part: a new IP sending to Gmail gets rate-limited and occasionally spam-foldered for the first weeks regardless of perfect DNS. Send low volume, to people who reply, and it settles.
Backups are built in; test them anyway
The admin panel schedules encrypted incremental backups using duplicity, to local disk, an rsync target, Amazon S3 or Backblaze B2. Turn it on the day you install, because the whole point of a dedicated box is that it can be rebuilt: reinstall Ubuntu, rerun the setup script, restore the backup directory, and the users, mail and DNS come back. Do one test restore into a throwaway VPS before you move a real domain over. The honest guide to self-hosted email covers why that rebuild path is the thing that separates a hobby from a liability.
Where mailcow or Mailu win
mailcow is the choice for a Docker host you already run, with a richer admin UI, per-domain policies and a modern webmail; it wants 6 GB of RAM at last check and expects you to understand its 20-odd containers. Mailu sits between the two, Docker-based and lighter, with fewer opinions than Mail-in-a-Box about owning the host. Both let you tune Postfix. Mail-in-a-Box's answer to "can I change this" is usually no, and for a first mail server that is the correct answer more often than not.
What I'd do
A small dedicated VPS from a provider that confirms port 25 and PTR control in writing, Mail-in-a-Box installed on 22.04 with the box as nameserver, backups to B2 switched on before the first user exists, and no secondary MX, because the box handles queueing fine. Move one low-stakes domain first, watch deliverability for a month, then move the family. If the idea of a machine you cannot customise bothers you, you are not the target user; pick mailcow and accept the extra work.
Compare Mail-in-a-Box
9 head-to-head comparisons.
Similar mail servers apps
listmonk
Mail ServersSelf-hosted newsletter and mailing list manager
Replaces Mailchimp, Sendinblue
Docker Mailserver
Mail ServersProduction-ready, config-driven mail server in a container
Replaces Google Workspace, Microsoft 365
Mailspring
Mail ServersCross-platform desktop email client
Replaces Outlook, Apple Mail
Postal
Mail ServersComplete mail delivery platform for outgoing email
Replaces SendGrid, Mailgun
MailHog
Mail ServersEmail testing tool with a fake SMTP server
Replaces Mailtrap
mailcow
Mail ServersDockerized full-stack mail server suite
Replaces Microsoft Exchange, Google Workspace