How to Set Up Mailcow: Dockerized Email Server on Contabo VPS (Self-Hosted Guide)
Contabo High-Performance Cloud VPS
Massive 4 vCPU cores, 8GB RAM, and 32TB monthly traffic. Ideal for Linux developers.
The Financial Burden of Enterprise Email SaaS
Google Workspace and Microsoft 365 charge between $7.20 and $18 per user per month. For a growing agency or business with 25 employees and several domain aliases, email licensing alone costs upwards of $2,000 to $5,000 annually. By deploying Mailcow: Dockerized on a high-RAM Contabo Cloud VPS, you can host thousands of mailboxes with enterprise spam filtering, modern webmail, and full data sovereignty for just $8.50 per month.
Server Requirements and Choosing the Right Contabo Tier
Mailcow is an enterprise-grade suite comprising Postfix, Dovecot, Nginx, MariaDB, Redis, Rspamd (spam filtering), and ClamAV (antivirus scanning). ClamAV alone requires at least 4 GB of RAM to hold virus signature databases in memory:
- Recommended VPS: Contabo Cloud VPS 2 (6 vCPU cores, 16 GB RAM, 100 GB NVMe).
- Operating System: Clean installation of Ubuntu 24.04 LTS.
- Clean IP Address: Verify your allocated IP is not on Spamhaus or Barracuda blacklists.
Step 1: Setting Up Reverse DNS (rDNS / PTR Record)
Receiving mail servers (Gmail, Outlook, Yahoo) reject incoming emails if the sending server's IP does not resolve back to its Fully Qualified Domain Name (FQDN). On Contabo:
- Log in to the Contabo Customer Control Panel (CCP).
- Navigate to IP Management -> Reverse DNS.
- Locate your VPS IPv4 address and set the PTR value to your mail hostname (e.g.
mail.yourdomain.com). - Save changes and allow 1 hour for global DNS propagation.
Step 2: Configuring DNS Records at Your Registrar
Add the following mandatory records to your domain's DNS zone:
# Mail Host A Record
mail.yourdomain.com. IN A YOUR_CONTABO_IP
# Primary MX Record
yourdomain.com. IN MX 10 mail.yourdomain.com.
# Autodiscover & Autoconfig for Outlook / Thunderbird
autodiscover.yourdomain.com. IN CNAME mail.yourdomain.com.
autoconfig.yourdomain.com. IN CNAME mail.yourdomain.com.
# Sender Policy Framework (SPF)
yourdomain.com. IN TXT "v=spf1 mx a:mail.yourdomain.com ~all"
# DMARC Policy
_dmarc.yourdomain.com. IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com"
Step 3: Installing Docker & Git Dependencies
Connect to your Contabo VPS via SSH and prepare the host:
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl git apt-transport-https ca-certificates gnupg
# Install Docker CE
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo systemctl enable --now docker
Step 4: Cloning Mailcow and Generating Configuration
Mailcow lives in /opt/mailcow-dockerized:
cd /opt
sudo git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
# Run the interactive configuration generator
sudo ./generate_config.sh
During the script execution, enter:
- Mail server hostname:
mail.yourdomain.com - Timezone:
UTCor your local timezone - Branch:
master
Step 5: Pulling Images and Launching the Stack
Download the container images and launch Mailcow in background mode:
sudo docker compose pull
sudo docker compose up -d
Inspect the running containers to verify health status:
sudo docker compose ps
Step 6: Logging in to Mailcow Admin & Activating DKIM
- Open your browser and navigate to
https://mail.yourdomain.com. - Log in using default credentials: Username
admin, Passwordmoohoo(change immediately under Administrator settings). - Go to Configuration -> Mail Setup -> Domains and click Add Domain.
- Under the DKIM tab, generate a 2048-bit DKIM key for your domain.
- Copy the public key value and publish it as a TXT record at
dkim._domainkey.yourdomain.com.
Step 7: Testing Deliverability
Create a test mailbox, log in to SOGo webmail at https://mail.yourdomain.com/SOGo, and send a test message to mail-tester.com. With SPF, DKIM, DMARC, and Contabo's rDNS aligned, you will achieve a perfect 10/10 score.
Frequently Asked Questions (FAQ)
Does Contabo block port 25?
On new accounts, Contabo sometimes blocks outbound port 25 to prevent spam abuse. Simply open a quick ticket with Contabo support stating you are running a private business mail server; their team unblocks port 25 promptly once identity is verified.
Editorial Verdict: Pros & Cons
What We Love (Pros)
- Host unlimited business email domains and mailboxes with zero per-user licensing fees
- Contabo allows setting reverse DNS (PTR record) directly inside their Customer Control Panel
- Includes modern SOGo webmail, CalDAV calendars, CardDAV contacts, and automated Let's Encrypt SSL
- Contabo VPS 2 (16GB RAM) easily handles Mailcow's ClamAV anti-virus engine and spam filters
Drawbacks (Cons)
- Requires unblocking outbound SMTP port 25 with your VPS host
- Demands strict adherence to IP warmup and email deliverability practices
Deploy Your Contabo Cloud Server
Includes 4 vCPU Cores, 8GB RAM, 50GB NVMe SSD, and 32TB Outbound Traffic.
Written by Alex Vance
Cloud Infrastructure Architect
Alex and the ServerCraft engineering lab run routine benchmarks on over 25 web hosting providers, maintaining strict objectivity and reproducibility.
Recommended Next Reads
Hostinger vs Contabo VPS (2026): Real Benchmark Test & In-Depth Comparison
A comprehensive, benchmark-driven comparison between Hostinger and Contabo VPS. We tested Geekbench CPU scores, NVMe I/O, network latency, and hPanel vs CLI.
Hostinger Review (2026): Is It Truly the Best Web Hosting for the Price?
We stress-tested Hostinger's Premium and Cloud Startup plans across 180 days. Read our honest review covering uptime, LiteSpeed speed tests, and renewal fees.