Running Your Own Mail Server on a VPS vs Using Hosting Email
With a VPS and an open-source package such as Mailcow or Mail-in-a-Box, you can have your own mail server running in an afternoon. Unlimited mailboxes, full control and no per-user fees sound like a good deal. The difficult part starts afterwards, when your messages need to reach Gmail and Outlook inboxes every day for years.
This article explains what running a mail server really involves, why deliverability is the hard part, and why most businesses are better served by hosting email or a dedicated email service.
What a mail server is made of
"A mail server" is really several services working together:
- An MTA (Postfix or Exim) that sends and receives messages over SMTP.
- An IMAP server (usually Dovecot) that stores mailboxes and serves them to phones and laptops.
- Spam and virus filtering (for example Rspamd and ClamAV) for incoming mail.
- DKIM signing for outgoing mail, plus webmail, TLS certificates and an admin interface.
Packaged suites such as Mailcow, Mail-in-a-Box, iRedMail, Mailu, docker-mailserver and Stalwart install all of this for you. They make the setup easier. They do not change anything described below.
Problem 1: deliverability depends on reputation
Large mailbox providers decide whether to accept your message, put it in spam or reject it, based largely on the reputation of your sending IP address and domain. Gmail's published requirements for everyone who sends to Gmail accounts include:
- SPF or DKIM authentication for the sending domain.
- Valid forward and reverse DNS (a PTR record) for the sending IP.
- TLS encryption for the connection.
- A spam complaint rate below 0.3% in Google's Postmaster Tools.
Senders of more than 5,000 messages a day to Gmail must also publish DMARC, align their From domain and offer one-click unsubscribe for marketing mail. Yahoo and Microsoft's Outlook.com have published similar rules for high-volume senders. Our guide to SPF, DKIM and DMARC explains each record.
Meeting the technical rules is only the entry ticket. A brand-new VPS IP has no sending history, so providers treat it with caution. If the previous user of that IP sent spam, you inherit their reputation. IP ranges belonging to hosting providers are also scored more strictly than those of established mail services, because that is where much spam originates.
Problem 2: PTR records and port 25
Two things are outside your control on a VPS:
- The PTR record. Reverse DNS for an IP can only be set by the owner of the IP range, which is your VPS provider. It must match your mail server's hostname, and that hostname must point back to the same IP.
- Outbound port 25. Many VPS providers block it on new servers to stop spam, and unblock it only on request, sometimes after a review. Policies differ, so ask before you build anything.
IPv6 is a common trap. If your server has IPv6 but no PTR record for that address, Gmail can reject messages delivered over IPv6. Either set a PTR for the IPv6 address too, or tell Postfix to send over IPv4 only:
# /etc/postfix/main.cf
inet_protocols = ipv4
Problem 3: blacklists
Blocklists such as Spamhaus and Barracuda are checked by many receiving servers. Your IP can be listed because:
- One mailbox password was guessed and the account was used to send spam overnight.
- A contact form or script on the same server was abused to send mail.
- Your IP sits in a range that some lists flag as a whole, regardless of your own behavior.
Getting delisted means finding and fixing the cause, then requesting removal, list by list. Meanwhile, part of your mail bounces. Our article on what to do when your domain is blacklisted describes the process.
Problem 4: the maintenance never ends
A mail server is not a set-and-forget service. Someone has to:
- Install security updates for the operating system and every mail component.
- Watch certificate renewals, because an expired certificate breaks every phone and laptop at once.
- Tune spam filtering, deal with false positives and answer "where is my email?" questions.
- Monitor the mail queue, disk space and blocklists, and read DMARC reports.
- Back up mailboxes and test that restores work.
- Handle outages. Sending servers usually retry for a while, but a long outage means delayed and eventually bounced mail.
Even when everything runs smoothly, budget a few hours a month for this. When something breaks, it is urgent by definition, because email is how customers reach you.
Own mail server vs hosting email
| Own mail server on a VPS | Hosting email (typical) | |
|---|---|---|
| Setup | Hours to days, plus DNS and provider requests | Minutes per mailbox |
| IP reputation | Starts at zero, your responsibility | Managed by the provider |
| PTR and port 25 | Must be arranged with the VPS provider | Already in place |
| Spam and virus filtering | You install and tune it | Included |
| Security updates | You apply them | The provider applies them |
| Backups | You design and test them | Part of the hosting backups |
| Who fixes it at 2 a.m. | You | The provider's support team |
When running your own mail server makes sense
- You want to learn how email works and can accept the occasional lost message.
- You have a strict requirement to keep mail on infrastructure you control, and an administrator with time and experience to run it.
- You are an organization with an IT team that already runs mail for many users.
If none of these fit, the cost in time almost always exceeds what you save on mailbox fees.
A better setup for most businesses
- Keep mailboxes on hosting email or a dedicated email plan on your own domain.
- Let applications on your VPS send through authenticated SMTP, either a mailbox on your hosting or a transactional email service, instead of running a local MTA that talks to the internet.
- Send newsletters through an email marketing platform. Mass mail from an ordinary mailbox damages reputation, as explained in our article on why you cannot send bulk email from a hosting mailbox.
- Publish SPF, DKIM and DMARC for every service that sends as your domain.
This keeps the parts that are hard to run (reputation, filtering, uptime) with providers that specialize in them, while your VPS stays free for the work you actually need it for.
If you still want to run one
- Confirm with your VPS provider that outbound port 25 is open, and ask them to set the PTR record.
- Set the server's hostname, for example
mail.example.com, with matching A and PTR records for IPv4 and IPv6. - Publish SPF, DKIM and DMARC before sending the first message.
- Use a valid TLS certificate for SMTP and IMAP.
- Enable brute-force protection and strong passwords for every mailbox.
- Back up mailboxes off the server.
- Monitor blocklists and start with low volumes, increasing gradually.
Frequently asked questions
Can my VPS app send email without a mail server?
Yes. Configure the app to send through SMTP with a username and password, using a mailbox on your hosting or a transactional email provider. Nothing on the VPS needs to accept incoming mail.
My SPF, DKIM and DMARC pass, so why does mail still go to spam?
Authentication proves who sent the message, not that recipients want it. Reputation, content and complaint rates also count. Our guide on emails landing in spam on Gmail covers the other causes.
Does a suite like Mailcow solve the deliverability problem?
No. It makes installation and administration easier, but reputation, PTR, port 25 and blocklists work the same for every mail server software.
Is running my own mail server cheaper?
On paper, sometimes: one VPS can hold many mailboxes. In practice, the hours spent on setup, updates, filtering, blocklists and support usually cost more than mailbox fees, unless you already have an administrator doing this work.
Every Hostinq.com hosting plan includes mailboxes on your own domain, from 1 on Ultra Economic to 8 on Bronze XX1, with support 09:00-03:00. If you need more mailboxes or a larger email setup, see our email hosting plans.