Mail-in-a-Box is an installer, not a container. It takes a clean Ubuntu server and configures Postfix, Dovecot, spam filtering, Roundcube webmail, Nextcloud for calendars and contacts, ActiveSync, a firewall, and its own DNS server. There are no configuration options; it is designed to just work.
1. It takes the entire machine
This is the thing to understand before anything else. Mail-in-a-Box expects a completely fresh Ubuntu 22.04 LTS 64 bit server and configures the whole system to its own design. You do not run websites, Docker, or anything else on it. Their documentation also states that containers and modified images are not supported, so a plain VPS with a stock Ubuntu image is what you want.
If you want mail alongside other services, use one of the container platforms in our comparison guide instead.
It requires Ubuntu 22.04, which is near the end of its life
Ubuntu 22.04 LTS reaches end of standard support in April 2027, while 24.04 and 26.04 are current. Mail-in-a-Box has not moved to a newer base yet. That is fine for now, but it means a rebuild rather than an in-place upgrade at some point. Check their release notes for the current supported Ubuntu version before you start.
2. Requirements
Port 25 must be open, and your DNS must be yours to control. Our guide on what running your own mail server actually takes covers the rest.
The project's own minimum is 512 MB of RAM, and it recommends 1 GB. In practice 1 to 2 GB with 20 GB of disk is a comfortable starting point, because Nextcloud and the spam filter both want room.
3. Set the hostname first
Mail-in-a-Box uses the machine's hostname as its primary hostname, so set it before you run the installer. The convention is box.example.com:
$ sudo hostnamectl set-hostname box.example.com $ sudo apt-get update && sudo apt-get -y upgrade
Then create an A record for that hostname pointing at your server, and set reverse DNS to match. Our reverse DNS guide covers the second part, which is self-service on a D4 VPS.
4. Run the installer
$ curl -s https://mailinabox.email/setup.sh | sudo -E bashIt asks for your primary hostname, your email address, and whether the box should act as your DNS nameserver. Answer the questions and let it run; it installs and configures everything.
That command pipes a script from the internet into a root shell. If you would rather not, download the script, read it, and then run it. The source is published on GitHub.
5. Let it run your DNS, or do not
The installer offers to be your authoritative DNS server, and that is the recommended path. If you accept, Mail-in-a-Box generates a complete zone with SPF, DKIM, DMARC, DNSSEC, and MTA-STS records already correct, and tells you the glue records to set at your registrar.
Getting those records right by hand is the step that defeats most self-hosted mail setups, and here it is done for you. It is the main reason to choose this platform.
If you keep DNS elsewhere, the control panel shows you every record it expects so you can publish them yourself.
6. Log in to the control panel
https://box.example.com/admin
The certificate is self-signed until Let's Encrypt issues a real one, so your browser warns you. Accept it for the first login, then find the TLS certificate section of the control panel and provision a real certificate. It sometimes takes two attempts.
Sign in with the email address and password you set during installation. Then create your mailboxes under Mail, Users.
7. Use the status checks page
The control panel has a Status Checks page that tests every part of the setup and fails anything out of compliance: DNS records, reverse DNS, certificates, blocklist status, and system updates.
Run it after any change and work down the list until everything passes. It tells you your reverse DNS is wrong before a remote server rejects your mail for it.
8. Spam filtering
Spam filtering and greylisting are configured and running by default, and there is very little to tune. Messages classified as spam land in the user's Junk folder.
The filter learns from your users. Moving a message into Junk trains it as spam, moving it out trains it as legitimate, and that feedback is what improves accuracy over time. There is no scoring interface, so this is the main way to influence the filter.
9. Backups and updates
Backups are built in and configured from the control panel. It can write to the local disk, another server over SSH, or S3-compatible storage. Point it somewhere off this machine, because a backup on the same server does not survive the failure it exists for.
To update, run the same install command again:
$ curl -s https://mailinabox.email/setup.sh | sudo -E bashQuick reference
| Task | Command or place |
|---|---|
| Install and update | curl -s https://mailinabox.email/setup.sh | sudo -E bash |
| Set hostname first | hostnamectl set-hostname box.example.com |
| Control panel | https://box.example.com/admin |
| Check everything | Status Checks page |
| Certificates | Control panel, TLS certificates, provision |
| Backups | Control panel, backup settings, point it off the server |
Where to go next
Work the Status Checks page until every item passes, then send a test message in each direction. Remember this server is now dedicated to mail. Adding other services to it is the most common way these installs get broken.