Complete setup guide, 2026
Self-hosted email server. Your domain, your mailboxes, your server.
Many big clouds block the port mail leaves on. Here’s a server where it’s open, the software that fits, and every record the big inboxes check.
What Gmail and Yahoo check on your mail
- Reverse DNS (PTR)Forward and reverse matchAll senders
- SPF or DKIMBoth for bulk sendersAll senders
- DMARCOver 5,000 a day at GmailBulk senders
From Gmail's and Yahoo's published sender rules.
LiteKeep Lite 8, for Mailcow
$12
- Port 25 open
- Reverse DNS
- Static IPv4
- KVM
- Docker
- Crypto
8 vCPU, 8 GB, 160 GB NVMe. Mail-in-a-Box runs on a Lite 2.
The short answer
To run your own email server you need three things: a server whose outbound port 25 is open, a static IP address you can set reverse DNS on, and a domain. Then you install all-in-one mail software and add five DNS records.
Mail-in-a-Box runs on 1 GB of RAM; Mailcow, with webmail and spam filtering, needs 6 GiB plus swap. Every LiteKeep server has port 25 open and reverse DNS on request. The builder below writes your DNS records.
Most guides to running your own mail server were written before 2024, when Gmail and Yahoo started rejecting mail that doesn’t authenticate. Others skip the first wall entirely: many cloud servers can’t send on port 25 at all until support agrees, if it ever does.
So this guide starts where mail actually fails. A server with port 25 open, software sized from its makers’ own figures, the five DNS records the big inboxes check, and commands to prove each one works.
In this guide you’ll learn
- What you need, and why port 25 decides it
- A setup builder: your plan, DNS records and checks
- Which mail software fits which server
- What Gmail, Yahoo and Outlook check
- Keeping your IP clean and your mail out of spam
- Self-hosted or relay: when to use each
Chapter 1
What you need to run your own mail server
Four things, and the first one is where most attempts end.
- Outbound port 25 openHow to check: Servers deliver mail to each other on port 25. Many big clouds block it by default and open it only by ticket, case by case. Every LiteKeep server has it open.
- A static IP with reverse DNSHow to check: Your IP must resolve back to your mail host name (a PTR record). Gmail and Yahoo require valid forward and reverse DNS from every sender. Request it on your server’s Network page.
- A domain you controlHow to check: You’ll add MX, SPF, DKIM and DMARC records to it.
- Enough RAM for your softwareHow to check: From 1 GB for Mail-in-a-Box to 6 GiB plus swap for Mailcow. The builder below picks the plan.
Chapter 2
Build your setup: plan, DNS records and checks
Choose your mail software and enter your domain and server IP. The builder names the plan from the software’s own requirements, writes your records, and gives you the commands to check them.
Your setup
Mailcow on a Lite 8.
Needs: 6 GiB of RAM plus 1 GiB of swap, 20 GiB of disk without mail, Docker, KVM. Webmail, spam and virus filtering and an admin panel, in Docker. 6 GiB is more than 6 GB, so a Lite 8.
DNS records (example values until you enter a domain and IP):
A mail.example.com 203.0.113.10 MX example.com 10 mail.example.com TXT example.com v=spf1 mx -all TXT _dmarc.example.com v=DMARC1; p=none; rua=mailto:postmaster@example.com PTR 203.0.113.10 mail.example.com
Add DKIM from your mail software’s admin page. Request the PTR record (reverse DNS) on your server’s Network page in our console.
Check it from the server:
nc -vz gmail-smtp-in.l.google.com 25 dig +short MX example.com dig +short A mail.example.com dig +short -x 203.0.113.10 dig +short TXT example.com dig +short TXT _dmarc.example.com
Start DMARC at p=none and read the reports for a few weeks; once SPF and DKIM pass, raise it to quarantine or reject.
Chapter 3
Which mail software fits which server
All-in-one stacks install the mail server, spam filtering, webmail and certificates together. Pick by how much you want built in.
| Software | What you get | Needs | LiteKeep plan |
|---|---|---|---|
| Mail-in-a-Box | Mail, webmail, DNS and certificates from one installer | Fresh Ubuntu 22.04, 512 MB minimum, 1 GB recommended | Lite 2 |
| Mailcow | Webmail, spam and virus filtering and an admin panel, in Docker | 6 GiB RAM plus 1 GiB swap, 20 GiB disk without mail, KVM | Lite 8 |
| docker-mailserver | A full mail server configured with files, no web panel | Docker, a static IP and a PTR record; no published RAM minimum | Lite 6 |
Our pick: Mail-in-a-Box for a person or a family on a few domains; Mailcow for a team that wants webmail and a panel. Mailcow asks for 6 GiB, which is a little more than 6 GB, so a Lite 8 gives it room. Every Lite is KVM, which Mailcow requires.
Chapter 4
What Gmail, Yahoo and Outlook check
Since 2024 the big inboxes publish what they require. Your server has to meet them before your first message.
| Every sender | Bulk senders | |
|---|---|---|
| Gmail | SPF or DKIM, valid forward and reverse DNS, TLS, spam rate under 0.3% | Over 5,000 a day: SPF and DKIM, DMARC, one-click unsubscribe |
| Yahoo | SPF or DKIM, valid forward and reverse DNS, spam rate under 0.3% | SPF and DKIM, a DMARC policy of at least p=none that passes |
| Outlook.com | Its general best practice | Over 5,000 a day: SPF and DKIM pass, DMARC at least p=none, aligned |
MythSelf-hosted mail always lands in spam.
Mail that meets these rules from a clean IP is accepted like anyone else’s. Most spam-folder problems are a missing PTR, SPF or DKIM.
MythYou need DMARC only for newsletters.
Gmail requires it for bulk senders, but it costs one TXT record and protects your domain from being spoofed. Add it from day one.
Chapter 5
Keep your IP clean and your mail out of spam
Receiving servers judge your IP address as well as your records.
- Check your IP on day one. Look it up in Spamhaus’s checker before you send. If an address is listed for something a previous user did, delete the server and deploy a new one for a fresh address: with hourly billing that costs cents.
- Start slowly. A new IP that suddenly sends thousands of messages looks like a spammer. Send your normal day-to-day mail and let volume grow.
- Never send from home. Home connections are on policy blocklists because mail should never come straight from them. A server with a static IP is the fix.
- Watch your spam rate. Gmail and Yahoo want it under 0.3%. Only send to people who asked.
Chapter 6
Self-hosted or relay?
Running your own mail server doesn’t mean you must send every message from it.
- Fully self-hosted. Your server receives and sends. Full control and privacy; you look after your IP’s reputation. This is what port 25 makes possible.
- Receive yourself, send through a relay. Mailboxes and storage stay on your server, and outgoing mail goes through a paid sending service. Useful for newsletters at volume.
- App mail only. Your website sends password resets and receipts straight from the server with Postfix. A Lite 2 is plenty.
Now it’s your move
Owning your email means owning the server it lives on, and that starts with a server allowed to send it. On a Lite, port 25 is open and reverse DNS is a request away.
Deploy a Lite 2 for Mail-in-a-Box or a Lite 8 for Mailcow, add your records with the builder, and send your first message from your own domain.