Mailcow is a complete open-source mail server solution that provides SMTP, IMAP, spam filtering, antivirus protection and a modern web interface. Mailcow uses Docker containers to simplify installation and management.
Minimum Server Requirements
- Ubuntu 22.04 server
- Minimum 6 GB RAM
- 2 CPU cores
- 40 GB disk space
- Dedicated public IP address
- Full DNS control over your domain
Recommended Domain Structure
mail.example.com → Mailcow server
example.com → main website
Step 1 – Connect to Your Server
ssh root@SERVER_IP
Step 2 – Update Your System
apt update && apt upgrade -y
Step 3 – Install Docker
curl -fsSL https://get.docker.com | sh
apt install docker-compose-plugin -y
Step 4 – Clone Mailcow Repository
git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
Step 5 – Generate Configuration
./generate_config.sh
Enter your mail hostname:
mail.example.com
Step 6 – Configure Firewall
ufw allow 25
ufw allow 465
ufw allow 587
ufw allow 143
ufw allow 993
ufw allow 110
ufw allow 995
ufw allow 80
ufw allow 443
Step 7 – Configure DNS Records
A Record
mail.example.com → SERVER_IP
MX Record
example.com → mail.example.com (priority 10)
SPF Record
v=spf1 mx ip4:SERVER_IP ~all
DMARC Record
_dmarc.example.com TXT
v=DMARC1; p=none; rua=mailto:[email protected]
Reverse DNS
Your server IP should resolve to:
mail.example.com
Step 8 – Start Mailcow
docker compose pull
docker compose up -d
Step 9 – Access the Mailcow Interface
https://mail.example.com
Default login:
Username: admin
Password: moohoo
Step 10 – Add Your Domain
Go to:
Configuration → Mail Setup
Add your domain and create mailboxes.
Step 11 – Configure DKIM
Go to:
Configuration → DKIM Keys
Generate DKIM keys and add the DNS record provided.
Email Client Settings
IMAP Server: mail.example.com
Port: 993
Encryption: SSL/TLS
SMTP Server: mail.example.com
Port: 587
Encryption: STARTTLS
Update Mailcow
cd mailcow-dockerized
./update.sh
Security Recommendations
- Always configure SPF, DKIM and DMARC
- Use strong passwords
- Enable firewall protection
- Keep Mailcow updated
Conclusion
Mailcow provides a powerful self-hosted email solution with spam filtering, antivirus protection and modern webmail.