Dockerized, self-hosted mail server suite bundling Postfix, Dovecot, SOGo, Rspamd and ClamAV behind a web admin UI.
mail-in-a-box/mailinabox
A one-click installer that turns a fresh Ubuntu 22.04 machine into a complete self-hosted mail server with webmail, DNS, and backups.
- Stars
- 15,448
- Forks
- 1,561
- Open issues
- 619
- Last commit
- 2 days ago
What is it?
Mail-in-a-Box is a set of scripts that turns a fresh Ubuntu 22.04 LTS machine into a working mail server. It installs and configures Postfix for SMTP, Dovecot for IMAP, Nextcloud for CardDAV and CalDAV, and z-push for Exchange ActiveSync, along with Roundcube webmail and nginx for client autoconfig.
The setup also handles the parts that usually make self-hosting email hard. It runs an nsd4 DNS server and sets SPF, DKIM, DMARC, DNSSEC, DANE TLSA, MTA-STS and SSHFP records automatically, provisions Let's Encrypt certificates, and adds spam filtering with SpamAssassin and greylisting with Postgrey. Backups, a ufw firewall, fail2ban and munin monitoring are included.
Administration happens through a web control panel and an API for managing users, aliases, custom DNS records and backups. A daily health check verifies that services run, ports are open, certificates are valid and DNS records are correct. The project is designed as a no-options appliance rather than a customizable stack.
Key features
- 01Installs SMTP, IMAP, webmail, CalDAV/CardDAV and ActiveSync on one Ubuntu machine.
- 02Sets SPF, DKIM, DMARC, DNSSEC and related DNS records automatically.
- 03Provisions and renews Let's Encrypt TLS certificates.
- 04Includes spam filtering, greylisting, firewall and fail2ban protection.
- 05Provides a web control panel and API for managing users, aliases and backups.
- 06Runs daily health checks on services, ports, certificates and DNS.
Use cases
- Running a personal or family mail server on a self-controlled VPS with your own domain.
- Hosting email for a small team that wants to avoid a third-party mailbox provider.
- Learning how the pieces of a production mail stack fit together.
Quick start
- 1
Clone the repository
git clone https://github.com/mail-in-a-box/mailinabox - 2
Enter the project directory
cd mailinabox - 3
Check out the tag of the most recent release
git checkout TAGNAME - 4
Start the installation on a fresh Ubuntu 22.04 machine
sudo setup/start.sh
Things to know
- It requires a completely fresh Ubuntu 22.04 LTS 64-bit machine.
- It has no user-configurable setup options and is not meant for power-user customization.
- Other mail providers may block or spam-filter email sent from your server.
In collections
Topics
FAQ
- What is mailinabox?
- A one-click installer that turns a fresh Ubuntu 22.04 machine into a complete self-hosted mail server with webmail, DNS, and backups. Mail-in-a-Box is a set of scripts that turns a fresh Ubuntu 22.04 LTS machine into a working mail server. It installs and configures Postfix for SMTP, Dovecot for IMAP, Nextcloud for CardDAV and CalDAV, and z-push for Exchange ActiveSync, along with Roundcube webmail and nginx for client autoconfig.
- Is mailinabox free to use? What license does it have?
- mailinabox is open source under the CC0-1.0 license. Check the license terms before using it in commercial products.
- Is mailinabox still maintained?
- Actively maintained. The last commit to mailinabox was on Oct 22, 2026.
- What can I use mailinabox for?
- Running a personal or family mail server on a self-controlled VPS with your own domain. Hosting email for a small team that wants to avoid a third-party mailbox provider. Learning how the pieces of a production mail stack fit together.
- How do I install mailinabox?
- Clone the repository: git clone https://github.com/mail-in-a-box/mailinabox Enter the project directory: cd mailinabox Check out the tag of the most recent release: git checkout TAGNAME Start the installation on a fresh Ubuntu 22.04 machine: sudo setup/start.sh
- Where can I get mailinabox?
- The source code and installation instructions are on GitHub: https://github.com/mail-in-a-box/mailinabox
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A self-hosted mail server packaged as a set of Docker images, covering SMTP, IMAP, POP3 and webmail.
A full-featured, secure mail server in Go for self-hosting your own domain's email with low maintenance.
Self-hosted mail server for your own domain, with SMTP/IMAP/POP3, CardDAV/CalDAV, a React webmail and admin console, deployed via Docker Compose.
Disposable email testing server that accepts mail for any address and exposes it via web, REST and POP3 interfaces.
A fast, open source desktop email client for Mac, Windows and Linux, built with Electron and a local C++ sync engine.