VPS or Dedicated Server for Email
| Server | Outgoing port 25 | How mail is sent |
|---|---|---|
| VPS | Blocked | Through a relay on port 587 or 465 |
| Dedicated server | Open | Directly to other mail servers, or through a relay |
A VPS still suits mailcow when you are happy to send through a relay: the Bronze VPS (6 GB) meets mailcow's minimum, and 8 GB or more its recommendation for 5 to 10 users. The rest of this guide assumes a dedicated server delivering directly.
| Processor | Memory | Storage | From |
|---|---|---|---|
| AMD Ryzen 9 5950X | 128 GB | 2x 1TB NVMe | $399.00/mo |
| AMD Ryzen 9 9950X | 192 GB | 2x 2 TB NVMe | $669.00/mo |
| AMD EPYC 4585PX | 128 GB | 2x 6.4TB NVMe Gen4 | $849.00/mo |
| AMD EPYC 7443P | 512 GB | 2x 2TB NVMe | $969.00/mo |
| AMD EPYC 9455P | 512 GB | 2x 3.2TB NVMe | $999.00/mo |
| AMD Dual EPYC 7702 | 512 GB | 2x 2TB NVMe | $1,099.00/mo |
| AMD EPYC 9455 | 512 GB | 4x 3.2TB NVMe | $2,299.00/mo |
1. Reverse DNS and DNS Records
Pick a mail hostname such as mail.example.com. Open a support ticket and ask us to set the reverse DNS (PTR) of the server's IPv4 address to that name: many receiving servers reject or junk mail from an address whose reverse DNS does not match. Then add these records at your DNS provider:
| Record | Name | Value |
|---|---|---|
| A | mail.example.com | The server's IPv4 address |
| MX | example.com | mail.example.com (priority 10) |
| TXT (SPF) | example.com | v=spf1 mx -all |
| TXT (DMARC) | _dmarc.example.com | v=DMARC1; p=quarantine; rua=mailto:[email protected] |
| CNAME | autodiscover and autoconfig | mail.example.com |
| TXT (DKIM) | dkim._domainkey.example.com | Copied from mailcow after install (step 4) |
If the mail hostname is behind a proxying service such as Cloudflare, set it to DNS only: mail cannot pass through a web proxy.
2. Prepare the Server
On Ubuntu 24.04 or Debian 13, secure the server and install Docker from Docker's own repository (mailcow needs Docker Engine 24 or newer and Compose 2). Make sure the clock is synchronised with timedatectl status, and that nothing else uses the mail or web ports:
ss -tlpn | grep -E -w '25|80|110|143|443|465|587|993|995|4190'
mailcow's documentation warns that ufw and firewalld can interfere with its containers; it publishes TCP 25, 465, 587, 143, 993, 110, 995, 4190, 80 and 443.
3. Install mailcow
sudo apt install -y git openssl curl gawk coreutils grep jq cd /opt sudo git clone https://github.com/mailcow/mailcow-dockerized cd mailcow-dockerized sudo ./generate_config.sh # enter mail.example.com when asked sudo docker compose pull sudo docker compose up -d
The installer fetches a Let's Encrypt certificate for the mail hostname once DNS points at the server. On a smaller server, set SKIP_CLAMD=y and SKIP_FTS=y in mailcow.conf to leave out the virus scanner and full-text search, which use the most memory.
4. Sign In and Add Your Domain
- Open
https://mail.example.com/adminand sign in with mailcow's default login,admin/moohoo. Change that password straight away and turn on two-factor authentication. - Add your domain under the mail setup pages, then create the mailboxes.
- Copy the domain's DKIM key from mailcow into the
dkim._domainkeyTXT record. - Send a test message to an outside address and check the headers show SPF, DKIM and DMARC as passed.
Keep It Delivering
- Never leave the server as an open relay, and use strong mailbox passwords: a hijacked mailbox sending spam gets the address blocklisted.
- Start with normal volumes; bulk newsletters belong on a service built for them.
- Check your address on public blocklists now and then, and read DMARC reports for mail others send in your name.
- Update with mailcow's
./update.shafter reading the release notes. - Back up with mailcow's backup script to another place, such as a storage box; mailboxes are hard to rebuild.
Just need a website or app to send mail? You do not need a mail server: see sending email from your server.