Mailcow is an open-source, Docker-based email server suite that provides SMTP, IMAP, webmail, admin panel, and built-in antispam. Deploy it on a VPS with at least 2GB RAM, configure DNS (MX, SPF, DKIM, DMARC, PTR), and you have a full email server for ~$5-10/month instead of $100+/month on Mailgun or SendGrid at equivalent volumes.
Mailcow Complete Setup Guide: Self-Hosted Email Server (2026)
Why Self-Host Email
You're paying Mailgun $75/month to send 50,000 emails. Or SendGrid $90/month. Or $250/month at higher volumes.
Mailcow on a $5 VPS handles the same volume. That's $840/year saved at 50K/month. At 500K/month, you're saving $3,000+/year.
But cost isn't the only reason. Self-hosted email gives you:
- Full control over your sending reputation
- Complete visibility into delivery logs
- No shared IP risk (your IP, your reputation, period)
- No ESP rate limits or throttling policies
- Data ownership (your email data stays on your server)
The trade-off: you manage the infrastructure. Mailcow makes this dramatically easier than bare Postfix, but it's still your responsibility.
Requirements
- VPS: 2GB RAM minimum (4GB recommended for 100K+/month)
- OS: Ubuntu 22.04 or Debian 12
- Port 25 open (check with your VPS provider before purchasing)
- Dedicated IPv4 with clean reputation (check blacklists before deploying)
- Domain name with full DNS control
- PTR record (reverse DNS) — must match your mail server hostname
Recommended VPS Providers
| Provider | Plan | RAM | Price | Port 25 |
|---|---|---|---|---|
| Hetzner CX21 | Cloud | 2GB | €4.90/mo | Open |
| Hetzner CX31 | Cloud | 4GB | €8.90/mo | Open |
| OVHcloud VPS | Starter | 2GB | ~$6/mo | Open |
| Vultr | Cloud Compute | 2GB | $12/mo | Open |
Hetzner is the go-to for self-hosted email. Cheap, reliable, port 25 open by default, and PTR records configurable in the dashboard. See our VPS comparison for more options.
Step 1: Server Setup
SSH into your VPS and prepare the system:
apt update && apt upgrade -y
apt install curl git -y
Set the hostname to match your mail server:
hostnamectl set-hostname mail.yourdomain.com
Step 2: Install Mailcow
cd /opt
git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
./generate_config.sh
The script asks for your mail server hostname (e.g., mail.yourdomain.com) and timezone. It generates mailcow.conf.
Start Mailcow:
docker compose up -d
First startup downloads containers and initializes. Takes 5-10 minutes. Access the admin panel at https://mail.yourdomain.com (default credentials: admin / moohoo).
Change the admin password immediately.
Step 3: DNS Configuration
This is the critical step. Configure these DNS records on your domain:
MX Record
yourdomain.com MX 10 mail.yourdomain.com
A Record
mail.yourdomain.com A YOUR_SERVER_IP
SPF Record
yourdomain.com TXT v=spf1 a mx ip4:YOUR_SERVER_IP -all
DKIM
Mailcow generates DKIM keys automatically. In the admin panel: Configuration → Domains → your domain → DKIM. Copy the generated TXT record and add it to DNS:
dkim._domainkey.yourdomain.com TXT v=DKIM1; k=rsa; p=YOUR_PUBLIC_KEY
DMARC
_dmarc.yourdomain.com TXT v=DMARC1; p=none; rua=mailto:[email protected]
PTR Record (Reverse DNS)
In your VPS provider's dashboard, set the PTR record for your IP to mail.yourdomain.com. This is critical — missing PTR records cause immediate rejection by many ISPs.
Autodiscover (Optional but recommended)
autodiscover.yourdomain.com CNAME mail.yourdomain.com
autoconfig.yourdomain.com CNAME mail.yourdomain.com
Step 4: Testing
After DNS propagates (1-24 hours):
- Send a test email from Mailcow's webmail to a Gmail and Outlook address
- Check headers — SPF, DKIM, and DMARC should all show
pass - Run Mail-Tester — send to their test address, aim for 9+/10
- Check blacklists — use MXToolbox to verify your IP isn't listed
Step 5: Connecting to GoHighLevel
In GoHighLevel → Settings → Email Services → Add SMTP:
- Host:
mail.yourdomain.com - Port:
587 - Username: a Mailcow mailbox (e.g.,
[email protected]) - Password: that mailbox's password
- Encryption: STARTTLS
Create a dedicated mailbox in Mailcow specifically for SMTP relay. Don't use your personal mailbox.
Cost Comparison
| Volume/Month | Mailgun | SendGrid | Self-Hosted (Mailcow) | Annual Savings |
|---|---|---|---|---|
| 10,000 | $35 | $20 | $5 | $180-$360 |
| 50,000 | $75 | $90 | $5-10 | $780-$1,020 |
| 100,000 | $175 | $135 | $10 | $1,500-$1,980 |
| 500,000 | $275 | $249 | $20 | $2,748-$3,060 |
Practitioner note: Mailcow is not set-and-forget. Plan for 1-2 hours/month of maintenance: updating Docker containers, checking logs, monitoring reputation. If you're not comfortable with a Linux terminal, self-hosting isn't for you.
Practitioner note: Always check your VPS IP against blacklists BEFORE deploying. Some VPS IPs are recycled from previous tenants who were spammers. If the IP is dirty, request a new one from your provider.
Practitioner note: For agencies running 5+ client domains on Mailcow, use Mailcow's multi-domain support with separate DKIM keys per domain. Don't share a single SMTP credential across clients.
If the setup and maintenance is what's holding you back, schedule a consultation — I set up and manage self-hosted SMTP infrastructure for clients who want the cost savings without the technical overhead.
Sources
- Mailcow: Official Documentation
- Mailcow: GitHub Repository
- Hetzner: Cloud Servers
v1.0 · March 2026
Frequently Asked Questions
How much does it cost to run Mailcow?
The software is free. You pay for hosting: a VPS with 2GB+ RAM and port 25 open costs $4.90-$9.90/month (Hetzner CX21 or similar). At 50,000 emails/month, that's $5/month vs $75/month on Mailgun. At 500,000 emails/month, it's $10-20/month vs $275/month on Mailgun.
Is Mailcow good for sending marketing email?
Mailcow can handle marketing email but it requires proper IP warmup, list management, and sending throttling that you manage yourself. For high-volume marketing, consider Mailcow for SMTP relay only and use your marketing platform for campaign management.
Can I connect Mailcow to GoHighLevel?
Yes. Use Mailcow's SMTP credentials in GoHighLevel's custom SMTP settings. Host: your Mailcow server hostname, Port: 587, Username/Password: a Mailcow mailbox account. All email from GHL routes through your self-hosted infrastructure.
Which VPS providers allow port 25 for email?
Hetzner, OVHcloud, and Vultr allow port 25 on most plans. DigitalOcean blocks port 25 by default but you can request it be opened (not guaranteed). AWS EC2 blocks port 25 — you need to request removal of the restriction. Avoid providers that permanently block port 25.
Is self-hosted email reliable enough for business?
Yes, with proper setup and monitoring. Mailcow includes automatic updates, built-in antispam (Rspamd), virus scanning (ClamAV), and a web admin panel. The risk is unmanaged maintenance — if your server goes down at 2am, you're the one fixing it.
Want this handled for you?
Free 30-minute strategy call. Walk away with a plan either way.