How to Run Your Own Mail Server on a VPS
To run your own mail server, you need a VPS with port 25 open, a reverse DNS (PTR) record, and a clean dedicated IP. Then you add six DNS records, test, and start sending slowly. This guide walks through each step. On FormoHost, port 25 is open and we set reverse DNS for you, on KVM VPS in 44 countries from $12 a month plus 10% tax.
- port 25 open
- reverse DNS
- dedicated IPv4
- full root
Check the VPS can send mail
Many cloud providers block port 25, the port mail servers use to talk to each other. If port 25 is blocked, your server can receive mail but cannot deliver it. Before you buy, check three things:
- Port 25 is openfor outgoing mail, not only incoming.
- Reverse DNS (PTR) can be setso your IP points back to a name like mail.example.com.
- A dedicated IPv4so your sending reputation is yours alone.
Pick a mail server stack
A mail server is several programs working together: one to send and receive (SMTP), one to store mailboxes (IMAP), a spam filter and a webmail. An all-in-one package installs them together.
| Stack | Good for | Memory |
|---|---|---|
| Mail-in-a-Box | One domain or a few, the fastest setup | 512 MB minimum, 1 GB recommended |
| mailcow | Teams, many domains, a full web admin panel | 6 GiB plus 1 GiB swap minimum |
| Postfix and Dovecot | People who want to set every part by hand | Small; depends on what you add |
Memory figures are from each project's own documentation: Mail-in-a-Box setup guide and mailcow system requirements. Check them again before you install, as they can change.
Add the DNS records
DNS records tell other mail servers that your server is allowed to send for your domain. Most mail problems come from a missing or wrong record here.
| Record | What it does | Example |
|---|---|---|
| A | Points your mail hostname to the server IP | mail.example.com → 203.0.113.10 |
| MX | Tells the world where to deliver your mail | example.com → mail.example.com |
| PTR | Points the IP back to your hostname | 203.0.113.10 → mail.example.com |
| SPF | Lists the servers allowed to send for you | v=spf1 mx -all |
| DKIM | Signs each message so it cannot be changed | Your mail stack creates this key |
| DMARC | Tells receivers what to do when checks fail | v=DMARC1; p=none; rua=mailto:you@example.com |
You set the A, MX, SPF, DKIM and DMARC records at your DNS provider. The PTR record is set by whoever owns the IP. On FormoHost, open a ticket with the hostname you want and we set it for you.
Test before you send
Send a test message to a Gmail account. Open it, choose Show original, and check that SPF, DKIM and DMARC all say PASS. Also check that your IP is not on a public blocklist. If a check fails, fix the DNS record first, then test again.
Start slowly
A new IP has no reputation yet. Send a small amount of normal mail in the first weeks, and grow from there. Only send mail that people asked for. Bulk unsolicited email gets any IP blocked fast, and it is not allowed under our terms of service.
FAQ
Short answers about running mail on a VPS. Billing, delivery and refunds are covered in the Help centre.
Open the Help centreIs port 25 open on FormoHost VPS?
Yes. Port 25 is open on every FormoHost VPS, so your mail server can send and receive mail directly.
Can I set reverse DNS (PTR)?
Yes. Open a ticket with the hostname you want, for example mail.example.com, and we set the PTR record for your IP.
How much RAM does a mail server need?
It depends on the stack. Mail-in-a-Box recommends 1 GB. mailcow needs at least 6 GiB of RAM plus 1 GiB of swap.
Why does my mail go to spam?
Usually a missing PTR, SPF, DKIM or DMARC record, or a new IP sending too much too soon. Check the message headers, fix the records, and send slowly at first.
Port 25 open and reverse DNS on request, from $12/mo.
See plans with port 25 openYour own mail server, in 44 countries.
Pick a country, pick a plan, and your KVM server is ready within 24 hours. Dedicated IPv4 on every plan, port 25 open, full root access.