Fork me on GitHub


Take back control of your email with this easy-to-deploy mail server in a box.

What is it?

Mail-in-a-Box lets you become your own mail service provider in a few easy steps. It’s sort of like making your own gmail, but one you control from top to bottom.

Technically, Mail-in-a-Box turns a fresh cloud computer into a working mail server. But you don’t need to be a technology expert to set it up.

Here’s how you can get a Mail-in-a-Box running:

Note: The video is a bit old. You now must select a server running Ubuntu 22.04 x64. The other steps remain almost entirely the same, so you can still use this video for reference.

Or check out a more recent instruction video made by a user.


Current Version

v68 / April 1, 2024

install start here!

Upgrading from version 5x or earlier? You will have to move to Ubuntu 22.04. Please read the release announcement for important details about upgrading.

release notes

upgrade instructions

Need Help?

  1. Check the maintenance guide.
  2. Ask on the forum. Other users may be able to help.
  3. Found a bug? Open an issue on github.
  4. Or try our Slack chatroom.

Download Stats

installs last month. Installs per month since our launch in August 2014:

What’s inside the box?

Each Mail-in-a-Box provides webmail and an IMAP/SMTP server for use with mobile devices and desktop mail software. It also includes contacts and calendar synchronization.

Roundcube Webmail
Nextcloud Contacts
A Control Panel

The box also includes other standard mail functionality like spam protection (spam filtering and greylisting), mail filter rules, email client autoconfiguration, and automated backups to Amazon S3 and other services.

The box also includes automatic DNS configuration when you let it become your nameserver so that it can set important DNS records for mail deliverability and security including SPF, DKIM, DMARC, and MTA-STS. When enabled, DNSSEC (with DANE TLSA) provides a higher level of protection against active attacks with other mail servers also running DANE TLSA. TLS certificates are automatically provisioned from Let’s Encrypt. (For more see our security practices.)

Your box can host mail for multiple users and multiple domain names. It also supports simple static website hosting (since the box is serving HTTP anyway), or you can host a website elsewhere (just add custom DNS records in your Mail-in-a-Box's control panel).

Mail-in-a-Box includes a web-based control panel where you can add mail accounts, mail aliases, and custom DNS records and set up backups. The control panel displays comprehensive status checks for DNS records and system activity/monitoring and supports TOTP-based two-factor authentication for login. Control panel functionality can also be accessed over the RESTful HTTP API (API documentation).

Note that while we want everything to “just work,” we can’t control the rest of the Internet. Other mail services might block or spam-filter email sent from your Mail-in-a-Box. This is a challenge faced by everyone who runs their own mail server, with or without Mail-in-a-Box. See our discussion forum for tips about that.

How do I get it?

The setup guide walks you through getting your own box set up. Users report it taking just a few hours to get to a fully operational system. And see the video above!

Legal note! Mail-in-a-Box is made available per the CC0 public domain dedication. By running Mail-in-a-Box, you will invoke scripts that use Let’s Encrypt to provision TLS certificates per the Let’s Encrypt Subscriber Agreement(s) & Terms of Services. Please be sure you accept the terms in both documents before beginning.

If you are an expert and have a domain name and a completely fresh Ubuntu 22.04 machine (note that containers and modified images are not supported) running in the cloud, you basically just run on that machine:

curl -s | sudo bash

You will be asked to enter the email address you want and a few other configuration questions. The script will install (and uninstall!) and configure a few dozen Ubuntu packages and the Mail-in-a-Box control panel. Consult the setup guide for complete details. See the README on github for advanced instructions.

Please note that the goal of this project is to provide a simple, turn-key solution. There are basically no configuration options and you can’t tweak the machine’s configuration files after installation. If you are looking for something more advanced, try iRedMail or Modoboa.

Note: Mail-in-a-Box’s maintainers work on Mail-in-a-Box in their limited free time. Your mileage may vary.

Why build this?

Mass electronic surveillance by governments revealed over the last several years has spurred a new movement to re-decentralize the web, a movement to empower individuals to be their own service providers again.

Although the core protocol of email, SMTP, is inherently decentralized, in practice email has become highly centralized because it is so damn difficult to implement the dozens of modern protocols that surround it. Mail-in-a-Box takes care of all of that, and no more.

This is important not just for privacy, but for the ability for the web to evolve and improve as it always has: through the ability of everyone to see how it works, tinker, and propose innovative changes.


If you need help, please check the maintenance guide and then ask on the forum. If you think you have found a problem in Mail-in-a-Box or don’t get a response on the forum, then open an issue on github.

We will post announcements and security advisories to our Fediverse/Mastodon account, our Twitter account @mailinabox, the announcements section of the discussion forum, and our Slack chat (see above).

Do not tweet or toot us questions: Always start on the forum so others can benefit from seeing your question too. Our social media is for announcements only.

Reporting spam/fraud/abuse: Mail-in-a-Box actually isn’t a mail service at all. It is more like a cooking recipe for how to create a mail service — therefore, we have no way to know who is following the recipe and have no control over people baking our cake to hide a poison. Like cake, there are many recipes for creating email servers besides Mail-in-a-Box (Microsoft Exchange Server being one of the most popular), and we are just unlucky when sometimes someone with bad intentions choses ours. In other words, we don’t control how people use Mail-in-a-Box and have no technical or legal means to disable other people’s services. You may want to check out the Mail-in-a-Box discussion forum and coordinate with anyone that has reported a similar situation recently.


Mail-in-a-Box is based on Ubuntu 22.04 LTS 64-bit and uses very-well-documented shell scripts and a Python management daemon to configure the system. Take a look at the system architecture diagram and security practices.

Development takes place on github at

Note that the goals of this project are to . . .

  • Make deploying a good mail server easy.
  • Promote decentralization, innovation, and privacy on the web.
  • Have automated, auditable, and idempotent system configuration.
  • Not make a totally unhackable, NSA-proof server (but see our security practices).
  • Not make something customizable by power users.

Additionally, this project has a Code of Conduct, which supersedes the goals above. Please review it when joining our community.

Mail-in-a-Box is dedicated to the public domain using CC0.

Joshua Tauberer (@JoshData) began this project in 2013 and is the primary maintainer. Thank you to all of the contributors!


This project was inspired in part by the "NSA-proof your email in 2 hours" blog post by Drew Crawford, Sovereign by Alex Payne, and conversations with @shevski, @konklone, and @GregElin.

Mail-in-a-Box is similar to iRedMail and Modoboa.

Mail-in-a-Box is based on Postfix, Dovecot, Roundcube, Nextcloud, Apache SpamAssassin, Postgrey, Nginx, and other open source software.