Mail-in-a-Box is a one-command installer that turns a fresh Ubuntu server into a fully configured email server with Postfix (SMTP), Dovecot (IMAP), Roundcube (webmail), SPF, DKIM, DMARC, DNSSEC, Let's Encrypt TLS, spam filtering, and a web admin panel. It requires a dedicated VPS with a clean Ubuntu 22.04 install, a domain name, and a VPS provider that allows port 25 (Hetzner, OVH, or DigitalOcean with port 25 unblock request).
Mail-in-a-Box Setup Guide: Email Server in 30 Minutes
Mail-in-a-Box: The Easiest Self-Hosted Email
Mail-in-a-Box is the "just works" option for self-hosted email. One script, 30 minutes, and you have a complete email server with webmail, spam filtering, and automatic DNS management. No Docker. No manual configuration. No editing config files.
The trade-off is flexibility. Mail-in-a-Box is opinionated — it makes decisions for you and doesn't offer much customization. For personal email or a small team, that's a feature. For complex setups, it's a limitation. For alternatives, see Mailcow or our comparison guide.
Prerequisites
Before you start:
- A VPS with a clean IP — check your IP against blacklists at MXToolbox before starting
- Ubuntu 22.04 LTS — fresh install, nothing else on the server
- A domain name — you'll point NS records to this server
- Port 25 open — verify your VPS provider allows outbound SMTP (check our VPS guide)
- PTR record configured — set reverse DNS to
box.yourdomain.comin your VPS control panel
Recommended VPS Specs
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | 1 GB | 2 GB |
| Disk | 10 GB | 40 GB |
| CPU | 1 vCPU | 2 vCPU |
| IPv4 | Dedicated | Dedicated |
Installation
SSH into your fresh Ubuntu server and run:
curl -s https://mailinabox.email/setup.sh | sudo bash
The installer walks you through:
- Email address — your first admin account (e.g., [email protected])
- Hostname — typically
box.yourdomain.com - Country code — for the SSL certificate
The script installs and configures everything automatically. It takes 10-20 minutes depending on your server's speed.
Post-Install DNS Setup
After installation, the admin panel at https://box.yourdomain.com/admin shows exactly which DNS records to configure. You have two options:
Option A: Use Mail-in-a-Box as DNS Server (Recommended)
Point your domain's nameservers to your Mail-in-a-Box server. The box manages all DNS records automatically — MX, SPF, DKIM, DMARC, DNSSEC, autoconfig.
At your registrar:
ns1.box.yourdomain.com → [your server IP]
ns2.box.yourdomain.com → [your server IP]
Option B: External DNS
Keep your existing DNS provider and manually add the records shown in the admin panel. You'll need to update DNS records manually when Mail-in-a-Box generates new DKIM keys.
What's Included
Mail-in-a-Box installs and configures:
- Postfix — SMTP sending and receiving
- Dovecot — IMAP mailbox access
- Roundcube — webmail interface
- Nextcloud — contacts and calendar sync
- nsd4 — authoritative DNS server
- SpamAssassin + Postgrey — spam filtering and greylisting
- Let's Encrypt — automatic TLS certificates
- OpenDKIM — DKIM signing
- Fail2ban — brute force protection
- Z-Push — Exchange ActiveSync for mobile
Adding Users
In the admin panel → Mail → Users:
- Enter email address and password
- The user can immediately access email via Roundcube webmail or configure a mail client
- Autoconfig/autodiscover is automatic — Thunderbird and Outlook find settings automatically
Limitations
Mail-in-a-Box is not for every use case:
- No Docker — runs directly on the OS, making it harder to isolate or migrate
- Single-server only — no clustering or horizontal scaling
- Ubuntu-only — requires Ubuntu 22.04 specifically
- Dedicated server — can't share the server with other applications
- Limited customization — configuration files are managed by the installer; manual edits get overwritten on updates
- Not designed for bulk sending — no queue management, rate limiting, or relay features
Practitioner note: Mail-in-a-Box is what I recommend to people who ask "I just want to run my own email and not think about it too much." It's genuinely the simplest path to self-hosted email. But I've also migrated three clients off Mail-in-a-Box to Mailcow when they outgrew its limitations — usually when they needed SMTP relay for applications.
Maintenance
Mail-in-a-Box is relatively low-maintenance:
- Updates: Re-run the install script monthly
- Backups: Built-in backup to S3-compatible storage (configure in admin panel)
- Monitoring: Check the status page in the admin panel weekly
- Blacklists: Check your IP at MXToolbox monthly
The admin panel's status page flags configuration issues, DNS problems, and security concerns automatically.
Practitioner note: The most common Mail-in-a-Box failure I see is people installing it on a VPS with a blacklisted IP and wondering why email goes to spam. Always check the IP reputation before installing. A clean IP is the foundation — no amount of correct configuration fixes a bad IP.
If you're deciding between Mail-in-a-Box, Mailcow, and other self-hosted options, schedule a consultation — I'll match the right solution to your scale and requirements.
Sources
- Mail-in-a-Box: Official Documentation
- Mail-in-a-Box: GitHub Repository
- Let's Encrypt: Getting Started
- MXToolbox: Blacklist Check
v1.0 · April 2026
Frequently Asked Questions
Is Mail-in-a-Box good for production use?
For small-scale personal or small business email (under 10 users, low volume), yes. For high-volume sending or agency use, no — it's not designed for bulk email, lacks advanced queue management, and doesn't scale well. Use Mailcow or Postal for those use cases.
What are the system requirements for Mail-in-a-Box?
Fresh Ubuntu 22.04 LTS, 1GB RAM minimum (2GB recommended), 10GB disk minimum, a dedicated IPv4 address with a clean reputation, and a VPS provider that allows outbound port 25. The server must be dedicated to Mail-in-a-Box — don't share it with other services.
How does Mail-in-a-Box handle DNS?
Mail-in-a-Box runs its own DNS server (nsd4) and manages all email-related DNS records automatically — MX, SPF, DKIM, DMARC, DNSEC, autoconfig, and autodiscover. You point your domain's NS records to the Mail-in-a-Box server and it handles everything.
Can I use Mail-in-a-Box with GoHighLevel?
Not well. Mail-in-a-Box is designed for mailbox hosting, not SMTP relay. It doesn't expose the SMTP relay functionality that GoHighLevel needs for outbound sending. Use Mailcow or Postal for GHL integration.
How do I update Mail-in-a-Box?
SSH into your server and run the same install command: 'curl -s https://mailinabox.email/setup.sh | sudo bash'. The script detects the existing installation and upgrades in place. Back up first.
Want this handled for you?
Free 30-minute strategy call. Walk away with a plan either way.