Business Email11 min read

Hosting Your Own Email Server on a VPS with Mailcow

In July 2026, Microsoft raised Microsoft 365 prices by up to 43% depending on the plan (12 to 16% on Business Basic and Standard) — a shock that pushed thousands of SMBs to reconsider their email strategy. On top of that, Microsoft announced the end of Exchange Web Services (EWS) in October 2026, rendering dozens of third-party integrations obsolete and forcing urgent migrations. In this context, self-hosting your email is no longer a hobbyist project: it is a strategic, financial, and data sovereignty decision. Mailcow, with over 13,200 GitHub stars, has established itself as the reference solution for organizations that want to take back control of their messaging without sacrificing the comfort of a modern interface. This guide walks you through deploying Mailcow on a Linux VPS, step by step.

Why Self-Host Your Email in 2026

Microsoft's price increase for Microsoft 365, effective 1 July 2026 — up to 43% depending on the plan was a wake-up call for many SMBs. An organization with 20 employees that was paying around €200 per month now faces bills of €285 or more, with no meaningful improvement in features. And that is not all: Microsoft has officially scheduled the shutdown of Exchange Web Services (EWS) for October 2026, making obsolete dozens of third-party integrations that relied on this protocol — shared calendars, CRM tools, in-house automations. Faced with these pricing and technical disruptions, self-hosted email has returned to the conversation with renewed legitimacy. Hosting your own mail server on a VPS offers three major advantages: full cost control (a properly sized VPS costs between €15 and €40 per month for 20 to 50 mailboxes), data sovereignty (your messages do not transit through a hyperscaler's datacenters), and simplified GDPR compliance (you know exactly where your data is stored and processed). For law firms, healthcare professionals, communication agencies, or any organization handling sensitive data, this last argument is often decisive.

What Mailcow Includes Out of the Box

  • Postfix + Dovecot: the time-tested open-source email duo — Postfix handles inbound and outbound SMTP, while Dovecot provides IMAP and POP3 access for your email clients.
  • Rspamd: a next-generation spam filtering engine far more accurate than SpamAssassin, with adaptive Bayes, greylisting, DKIM, ARC, and multi-factor scoring built in.
  • SOGo: a full-featured webmail client (calendars, contacts, tasks) with ActiveSync synchronization for Outlook and mobile devices, without needing Exchange.
  • Web administration panel: a modern control panel to manage domains, mailboxes, aliases, quotas, mailing lists, and DKIM policies in just a few clicks.
  • WebAuthn / two-factor authentication: enhanced security via hardware keys (YubiKey, etc.) or TOTP to protect admin access and individual user mailboxes.
  • Full REST API: all administration actions are exposed through a documented API, enabling automation of mailbox and alias creation, or integration into your own customer portal.
  • Built-in IMAP migration: the imapsync tool is available directly from the interface to pull messages from a source server (Gmail, Microsoft 365, cPanel…) without any command-line manipulation.
  • Automatic TLS certificates: Let's Encrypt is natively integrated — Mailcow renews certificates for your mail domain with no manual intervention required.

Technical and Network Prerequisites

Before starting the installation, make sure your VPS and network configuration meet the following requirements. On the hardware side, Mailcow requires at least 6 GB of RAM (3 GB is an absolute minimum, but performance will be degraded and some containers may crash under load). Plan for 2 vCPUs and at least 20 GB of disk space for containers and emails — 50 GB is a reasonable starting point for a small organization. On the network side, several points are non-negotiable. First, port 25 must be open outbound: many hosting providers block it by default to fight spam. Check with your provider before ordering. Second, you must be able to configure the rDNS (reverse DNS / PTR record) for your IP: this allows recipient servers to verify that your IP actually maps to your mail hostname — without a correct PTR, your emails will land in spam at most major providers. Third, you need a domain name whose DNS you control (adding MX, A, and TXT records). Finally, a VPS running Debian 12 or Ubuntu 24.04 LTS is recommended for optimal compatibility with Docker and the Mailcow scripts.

Installing Mailcow in 8 Steps

01

Provision the VPS and Configure rDNS

Order a VPS with at least 6 GB of RAM, 2 vCPUs, and a dedicated IP. In your hosting control panel, navigate to the rDNS (or PTR record) section and map your IP to mail.yourdomain.com. This setting is critical: without a correct PTR, your emails will be systematically rejected or marked as spam by Gmail, Outlook, and other major providers. Allow up to 24 hours for PTR propagation.

02

Point Your Domain's DNS Records

In your DNS manager, create an A (or AAAA) record for mail.yourdomain.com pointing to your VPS IP. Add an MX record on yourdomain.com with the value mail.yourdomain.com and a priority of 10. Also prepare your SPF record (v=spf1 mx ~all) and DMARC record (_dmarc.yourdomain.com) — DKIM will be automatically generated by Mailcow when it first starts.

03

Install Docker and Docker Compose

Connect to your VPS via SSH as root. Install Docker using the official script: curl -fsSL https://get.docker.com | sh. Docker Compose v2 is included in modern Docker packages. Verify the versions with docker --version and docker compose version. Ensure the Docker service starts automatically with systemctl enable --now docker.

04

Clone the Repository and Generate the Configuration

Clone the official repository into /opt/mailcow-dockerized: git clone https://github.com/mailcow/mailcow-dockerized /opt/mailcow-dockerized. Enter the directory and run ./generate_config.sh. The script asks for your mail hostname (e.g., mail.yourdomain.com) and timezone. It generates the mailcow.conf file with secure random keys — do not manually modify these keys afterward.

05

Start Mailcow

From /opt/mailcow-dockerized, run docker compose pull to download all images (approximately 2 to 4 GB depending on your connection), then docker compose up -d to start all containers in the background. The first startup takes 2 to 5 minutes. Check container status with docker compose ps — all should show a status of Up or Up (healthy).

06

Access the UI and Create Your First Domain

Open your browser at https://mail.yourdomain.com. Default credentials are admin / moohoo. Change the admin password immediately. Under *Configuration → Domains*, add your domain. Then create your first mailbox under *Configuration → Mailboxes*. The interface is intuitive and well-organized.

07

Enable DKIM and Test Deliverability

Under *Configuration → ARC/DKIM Keys*, select your domain and click *Generate new key* (2048-bit length recommended). Copy the generated TXT record and add it to your DNS manager (TXT record on dkim._domainkey.yourdomain.com). Then send a test email from your new mailbox to [email protected], or use mail-tester.com for a comprehensive deliverability score.

08

Set Up Automated Backups

Mailcow provides an official backup script at helper-scripts/backup_and_restore.sh. Schedule a daily run via cron: 0 3 * * * /opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup all with the MAILCOW_BACKUP_LOCATION variable pointing to external storage (NFS mount, S3 bucket, remote directory via rsync). Test a restore before considering the backup operational.

Deliverability: Pitfalls to Avoid

A technically correct mail server can still have its messages land in spam if certain network and DNS conditions are not met. Here are the most common mistakes. Blacklists: your VPS IP may be listed in blacklists like Spamhaus or Barracuda if it was previously used for spam — this is common with datacenter IP ranges. Check your IP on mxtoolbox.com/blacklists.aspx before installation. If listed, request delisting from each organization or switch IPs. Port 25 blocked: some hosting providers block outbound port 25 on all new IPs for a probation period. Contact support before starting. Missing or misconfigured DKIM: an email without a valid DKIM signature is treated with suspicion by Gmail and Outlook. Verify with dig TXT dkim._domainkey.yourdomain.com that the record is visible. DMARC too permissive: start with p=none to collect reports without blocking, then move to p=quarantine and p=reject once you are confident all legitimate mail streams are covered by SPF and DKIM. Missing PTR record: the most commonly forgotten point. Without a PTR record resolving to your mail hostname, Microsoft Outlook will reject your emails with a 550 error.

Mailcow behind Nginx Proxy Manager: if your VPS hosts other web services (website, application), you can run Mailcow alongside Nginx Proxy Manager on the same IP. The key is to let NPM handle only ports 80 and 443 (HTTP/HTTPS) as a reverse proxy, while Mailcow retains direct control over SMTP ports (25, 465, 587) and IMAP/POP3 (993, 995). In mailcow.conf, set HTTP_BIND=127.0.0.1 and HTTPS_BIND=127.0.0.1, then configure NPM to proxy to 127.0.0.1:80 and 127.0.0.1:443. Never try to route port 25 through an HTTP reverse proxy — SMTP does not work that way.

Migrating from Google Workspace or Microsoft 365 to Mailcow

Migrating existing emails is often what holds organizations back. Mailcow includes an IMAP migration tool directly in its interface (imapsync), making the operation accessible without advanced technical skills. The basic procedure is: (1) create the destination mailboxes in Mailcow, (2) navigate to *Extras → Import* in the admin interface, (3) enter the source server address, credentials, and start the sync. imapsync copies messages folder by folder, preserving dates and read statuses. The migration can be run multiple times before the final cutover (already-copied messages are skipped on subsequent passes), enabling a progressive cutover: you continue receiving mail on the old address while data migrates, then switch the MX record in a single operation. For Microsoft 365 with EWS, plan your migration before October 2026: some migration tools that rely on EWS will stop working after that date. Mailcow uses IMAP, not EWS, and is therefore unaffected — yet another reason to migrate early. For email clients, Thunderbird, Apple Mail, and mobile apps (iOS, Android) configure via standard IMAP/SMTP. Outlook works too, including calendar and contact sync via ActiveSync (SOGo).

Comparison: Mailcow vs Mailu vs iRedMail

Mailcow is not the only Docker-based self-hosted email solution. Here is how it compares to its main competitors. Mailu is lighter on resources (runs with 1 GB of RAM) and suits personal use or very small organizations. Its interface is minimalist, it does not include SOGo, and its feature set is more limited. It is an excellent choice when simplicity is a priority over features. iRedMail is a mature solution, available as a community edition and a paid Pro version (iRedMail Pro). It supports multiple database backends (MySQL, PostgreSQL, LDAP) and installs directly on the host system without Docker. Its configuration curve is steeper, and updates are less automated. iRedMail Pro adds a paid web management interface that competes with Mailcow's. Mailcow stands out for the richness of its features, the quality of its administration interface, the frequency of its updates (monthly releases), and the size of its community (13,200+ GitHub stars). It is the natural choice for an SMB that wants a complete, actively maintained solution with abundant documentation. The trade-off is RAM consumption: 6 GB minimum is a non-negotiable requirement.

Maintenance and Version Upgrades

Mailcow publishes monthly updates (usually on the first Fridays of the month) that fix security vulnerabilities, improve spam filters, and add features. The official update procedure is straightforward and well-documented. From the /opt/mailcow-dockerized directory, run ./update.sh. This script pulls the new Docker images, applies any configuration migrations, and restarts the affected containers. The operation typically takes 5 to 15 minutes with less than a minute of service interruption for the restarted containers. Do not use Watchtower (the automatic Docker container update tool) with Mailcow. Mailcow updates sometimes involve database migrations or configuration changes that require running update.sh in the correct order. Letting Watchtower pull and restart images autonomously can corrupt your installation. Schedule updates during a known maintenance window (for example, Saturday morning), review the release notes on the Mailcow forum before applying, and verify container status with docker compose ps after each update. A backup on the eve of each major update is strongly recommended.

When Self-Hosting Email Is Not Advisable

Self-hosting email is not a universal answer. There are situations where Google Workspace or Microsoft 365 remains the more sensible choice, even after the price increase. If you lack in-house technical expertise: managing a mail server requires regular security monitoring, proactive updates, and the ability to diagnose deliverability issues. Without these skills, you risk being left without email during a critical incident. If deliverability is absolutely critical: large-scale transactional email operations (banks, insurers, high-volume e-commerce platforms) benefit from the reputation of shared IPs professionally managed by ESPs (Mailgun, Postmark, Brevo). A solo VPS starts with a fresh IP whose reputation must be built from scratch. If your hosting provider blocks port 25: some cloud operators (particularly on entry-level plans) permanently block this port to combat spam. Verify before committing. If you operate in a strictly regulated industry: some sectors (finance, healthcare) impose certification or audit requirements for email infrastructure that can be difficult to satisfy with self-hosting without specialized support.

Conclusion: An Email Server That Belongs to You

Self-hosting your email server with Mailcow on a VPS is now within reach of any organization with a minimum of technical maturity. The solution is mature, actively maintained, and delivers a functional level that honestly competes with commercial offerings — at a fraction of the cost. Microsoft 365's price increase and the end of EWS in 2026 have transformed self-hosting from a fringe option into a strategic alternative for thousands of SMBs and agencies. With a properly sized VPS (6 GB RAM, dedicated IP with configured rDNS), a Mailcow installation takes less than an hour, and the migration of existing mailboxes can be done progressively without service interruption. Three things to remember before getting started: verify that port 25 is open with your hosting provider, configure the PTR record for your IP before sending your very first email, and set up external backups from day one. With these foundations in place, your email server will be just as reliable — and far more cost-effective — than a cloud subscription.

A VPS for Your Email Server

Mailcow requires at least 6 GB of RAM and 2 vCPUs. Our Linux VPS plans are delivered with Debian 12 or Ubuntu 24.04, root access, a dedicated IP, and configurable rDNS — essential for email deliverability.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.