🎬

Video tutorial coming soon.

🐄 Setup Mailcow — Full Email Server Suite

Deploy Mailcow Dockerized, a complete email server solution with Postfix, Dovecot, SOGo webmail, spam filtering, DKIM signing, and a modern web admin panel.

⚠️ This script is provided for demo and testing purposes only.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along.

Automated install script — complete Mailcow email server stack.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/email/mailcow/mailcow-ubuntu.sh
chmod +x mailcow-ubuntu.sh
sudo bash mailcow-ubuntu.sh

Tutorial Steps

1 Download & Run the Script

The script installs Docker, clones the Mailcow repo, generates the configuration file with your domain, and starts the full mail server stack (20+ containers).

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/email/mailcow/mailcow-ubuntu.sh
chmod +x mailcow-ubuntu.sh
sudo bash mailcow-ubuntu.sh

2 Access the Admin UI

Open your browser and navigate to the Mailcow admin panel. Default credentials are admin / moohoo:

https://YOUR-DOMAIN

3 Add Domain and Mailboxes

In the admin panel, add your domain, configure DNS records (MX, SPF, DKIM, DMARC) as shown in the UI, then create mailboxes for your users.

4 Connect Email Clients

Users can access email via the SOGo webmail at /SOGo, or configure any IMAP/SMTP client (Outlook, Thunderbird, Apple Mail) using the server settings in the Mailcow UI.

Ports Used

PortProtocolPurpose
25TCPSMTP (Receiving Mail)
80/443TCPWeb UI & SOGo Webmail
143TCPIMAP
587TCPSMTP Submission
465TCPSMTPS (SSL)
993TCPIMAPS (SSL)

Files Location

/root/docker/mailcow/docker-compose.yml

Overview

Mailcow is a full-featured, Docker-based mail server suite that bundles Postfix, Dovecot, SOGo webmail, spam filtering (rspamd), virus scanning (ClamAV), and DKIM signing into a single install. It provides a polished web admin panel for managing domains, mailboxes, aliases, and security policies.

Why Use It

Mailcow gives you complete control over your email infrastructure — your data never passes through Google, Microsoft, or any third party. It is the most feature-complete self-hosted mail server available, combining Postfix (SMTP), Dovecot (IMAP/POP3), SOGo (webmail + CalDAV/CardDAV), rspamd (spam filtering), ClamAV (antivirus), and a polished admin panel in one Docker Compose stack. For organizations that need privacy, data sovereignty, compliance, or simply want to cut $20–$100/month per user costs from Google Workspace or Microsoft 365, Mailcow is the gold standard.

When You Need It

    Who Should Use It

      Real Use Cases

        Main Features

          How to Use After Installation

            Security Best Practices

              Ports and Firewall Notes

              Mailcow requires ports 25 (SMTP), 587 (SMTP submission), 465 (SMTPS), 993 (IMAPS), 995 (POP3S), 4190 (Sieve), 80, and 443 open. The admin panel runs on 8080/8443 — keep this firewalled to trusted IPs only. Many VPS providers block port 25 by default; contact support to have it unblocked before deployment. Your VPS IP must have a PTR record pointing to your mail server hostname.

              Backup and Maintenance

                Common Mistakes

                  Troubleshooting

                    Alternatives

                    Mailu is the main self-hosted alternative — lighter, simpler, needs only 1 GB RAM, but has fewer features and a more basic admin panel. iRedMail is another option with strong documentation but a more manual setup. Modoboa is modern and Python-based but has a smaller community. If self-hosting mail is too complex, Migadu offers affordable managed email hosting with no per-user pricing, while Fastmail and ProtonMail are privacy-respecting cloud alternatives.

                    When Not to Use It

                    Avoid Mailcow if your VPS provider blocks port 25 and will not unblock it (common with AWS EC2, Oracle Cloud free tier, and some budget hosts). Do not use it if your server has less than 3 GB RAM — ClamAV alone needs over 500 MB. Avoid self-hosting email entirely if you cannot commit to ongoing maintenance (monitoring IP reputation, updating containers, handling bounces). For most small teams, a managed provider like Google Workspace or Migadu is cheaper in total operational cost than self-hosting.

                    Need Help Setting Up Mailcow?

                    PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.

                      Contact Us

                      Frequently Asked Questions

                      What are the minimum server requirements for Mailcow?

                      Mailcow requires at least 3 GB RAM (4 GB recommended), 2 CPU cores, and 20 GB disk space minimum. ClamAV (antivirus) is the biggest memory consumer — it needs ~600 MB alone. If you are on a low-RAM VPS, you can disable ClamAV in mailcow.conf to reduce memory usage to around 1.5 GB, but you lose virus scanning.

                      Why is my outbound mail going to spam?

                      The most common reasons are: (1) Missing or incorrect SPF record for your domain, (2) DKIM not configured or not published in DNS, (3) No DMARC record, (4) Your server IP is on a blacklist — check mxtoolbox.com, (5) No rDNS/PTR record for your IP. Fix all five issues and test at mail-tester.com before sending to real users.

                      How do I unblock port 25 on my VPS?

                      Port 25 is blocked by default on many VPS providers (AWS, Vultr, Linode, Oracle Cloud). Open a support ticket with your provider and request port 25 unblocking for mail server use. Some providers (AWS) never unblock it for residential-tier accounts — in that case, use SES relay or choose a provider that allows mail servers, like Hetzner or OVHcloud.

                      Can I host multiple domains on one Mailcow instance?

                      Yes. Mailcow supports unlimited domains on a single install. Add each domain under Configuration > Domains, then generate a DKIM key for each domain separately and publish the DNS records. Each domain can have its own mailboxes, aliases, quotas, and spam filter settings.

                      How do I migrate existing mailboxes from Gmail or Office 365 to Mailcow?

                      Mailcow includes imapsync integration in the admin panel under E-Mail > Mailbox Migration. Enter the source IMAP server, username, and password — imapsync will copy all messages folder by folder. For Gmail, enable IMAP in settings and use an App Password. Migration can take hours for large mailboxes; run it before switching MX records.

                      Is there a webmail client included?

                      Yes. Mailcow includes SOGo, a full-featured webmail client accessible at https://mail.yourdomain.com/SOGo. SOGo also provides CalDAV (calendar sync) and CardDAV (contacts sync) — compatible with Thunderbird, Apple Mail, and Outlook. You can also configure any IMAP client using your mail server's hostname on ports 993 (IMAP) and 587 (SMTP).

                      How do I update Mailcow?

                      Run `cd /opt/mailcow-dockerized && ./mailcow.sh update` — this pulls the latest images, applies any database migrations, and restarts containers. Mailcow publishes updates regularly; subscribe to the Mailcow changelog or GitHub releases. Always back up before updating. Updates are generally smooth but read the release notes for any breaking changes.

                      What happens if my server goes offline — do I lose emails?

                      Sending servers retry delivery for 24–72 hours after a temporary failure (greylisting/5xx), so short outages do not cause permanent email loss. For high availability, set up a backup MX record pointing to a secondary server or a mail relay that queues messages during downtime. Monitor server uptime with Uptime Kuma to respond quickly to outages.