MCPSERV.CLUB
Mail-in-a-Box

Mail-in-a-Box

Self-Hosted

One‑click mail server for personal control

Active(75)
15.0kstars
0views
Updated Jul 28, 2025

Overview

Discover what makes Mail-in-a-Box powerful

Mail‑in‑a‑Box is a turnkey, self‑hosted mail appliance that turns a clean Ubuntu 22.04 LTS VM into a fully functional, secure email stack with a single script run. From a developer’s point of view it is an opinionated, idempotent configuration‑management system that bundles the core services required for a modern mail provider—SMTP, IMAP, webmail, calendar/contacts, DNS, TLS, and monitoring—into a coherent, auditable deployment.

Operating System

Mail Transport

Mail Retrieval

Web & Calendar

Overview

Mail‑in‑a‑Box is a turnkey, self‑hosted mail appliance that turns a clean Ubuntu 22.04 LTS VM into a fully functional, secure email stack with a single script run. From a developer’s point of view it is an opinionated, idempotent configuration‑management system that bundles the core services required for a modern mail provider—SMTP, IMAP, webmail, calendar/contacts, DNS, TLS, and monitoring—into a coherent, auditable deployment.

Technical Stack & Architecture

  • Operating System – Ubuntu 22.04 LTS (Debian‑based, 64‑bit).
  • Mail Transportpostfix (MTA) configured with postgrey for greylisting and OpenDKIM for DKIM signing.
  • Mail Retrievaldovecot (IMAP/POP3) with integrated spam filtering via spamassassin.
  • Web & CalendarNextcloud for CalDAV/CardDAV, Roundcube as the webmail UI, and z-push for Exchange ActiveSync.
  • Web Servernginx hosts webmail, static content, and the auto‑configuration endpoint.
  • DNSnsd4 runs as an authoritative server, automatically generating SPF, DKIM, DMARC, DNSSEC, DANE TLSA, and MTA‑STS records.
  • TLS – Let’s Encrypt integration via certbot (or an internal wrapper) provisions certificates for all services.
  • Monitoring & Securityufw firewall, fail2ban, basic system monitoring (munin), and daily health checks.
  • Backupduplicity snapshots to remote storage, managed via the control panel.

The entire stack is orchestrated by a Bash‑based bootstrap script that performs package installation, configuration templating, and service orchestration. The result is an idempotent deployment: re‑running the script on an existing box will re‑apply configuration without side effects.

Core Capabilities & APIs

  • Control Panel – A web‑based UI that abstracts user, alias, and DNS management.
  • REST API – Exposes all control‑panel actions (user CRUD, alias management, DNS record manipulation, backup configuration) for programmatic automation.
  • Webhook Support – The API can trigger HTTP callbacks on events such as new user creation or DNS record changes.
  • Extensible DNS Records – The API allows arbitrary TXT/CAA/AAAA records, enabling integration with external services (e.g., Cloudflare).
  • Mail Flow Hooksdovecot and postfix can be extended via custom scripts (postinst, preexec) to inject business logic (e.g., content filtering, analytics).

Deployment & Infrastructure

  • Self‑Hosting – Requires a dedicated VM or bare‑metal server with a public IP, 2 GB RAM minimum (4 GB recommended), and at least 20 GB of SSD storage.
  • Scalability – While designed for single‑tenant use, the architecture can be scaled horizontally by adding more mail servers behind a load balancer and synchronizing DNS via nsd zones.
  • Containerization – No official Docker image, but the component stack can be containerised manually; each service (postfix, dovecot, nginx, nextcloud) can run in its own container with a shared volume for mail data.
  • Infrastructure as Code – The bootstrap script can be idempotently applied via Ansible, Terraform (cloud‑init), or cloud‑native CI/CD pipelines.

Integration & Extensibility

  • Plugin System – Nextcloud’s plugin ecosystem extends contacts/calendar; Roundcube plugins add custom filters or UI tweaks.
  • Custom DNS Zones – The API allows adding custom zones, making it straightforward to host additional domains or subdomains.
  • Webhooks & Scripts – Developers can hook into mail events (e.g., deliver‑to, bounce) by configuring Postfix header_checks or Dovecot ACLs to trigger external services.
  • API Rate Limits & Authentication – OAuth2 or API keys can be enforced by wrapping the REST endpoint with a lightweight auth layer.

Developer Experience

  • Documentation – The README, website, and GitHub wiki provide step‑by‑step guides; the API is documented inline with examples.
  • Community & Support – Active GitHub contributors, a Slack channel, and a public forum foster rapid issue resolution.
  • Configuration Simplicity – No manual editing of /etc/postfix/main.cf or dovecot.conf; all settings are templated and version‑controlled.
  • Auditability – Configuration files are stored under /etc/mailinabox/, making it easy to diff changes or roll back.

Use Cases

  1. Small‑Business Mail Server – Deploy a single box to host internal and external email for up to ~200 users with minimal overhead.
  2. Privacy‑Focused Service – Provide end‑to‑end encrypted email for a niche community, leveraging the built‑in TLS and DNSSEC stack.
  3. Developer Sandbox – Spin up a temporary mail environment for testing webhooks, email templates, or SMTP integrations.
  4. Educational Platform – Use as a teaching tool for students learning about mail infrastructure, DNS, and security best practices.

Advantages Over Alternatives

| Criterion | Mail

Open SourceReady to get started?

Join the community and start self-hosting Mail-in-a-Box today

Weekly Views

Loading...
Support Us

Featured Project

$30/month

Get maximum visibility with featured placement and special badges

Repository Health

Loading health data...

Information

Category
apis-services
License
CC0-1.0
Stars
15.0k
Technical Specs
Pricing
Open Source
Database
Multiple
Supported OS
Linux
Author
mail-in-a-box
mail-in-a-box
Last Updated
Jul 28, 2025