◦ Comprehensive security
◦ 24/7 support
VPS → Email Server
How to make an email server with a VPS
If you’re tired of relying on Gmail or Microsoft for business email—or you’re frustrated with their limits on storage, privacy, or pricing—building your own email server might be the move. With just a VPS and a little setup, you can run secure, reliable email that you control completely.
Maybe you’re setting this up for your business. Maybe you’re managing email for a handful of clients. Either way, you don’t have to be a systems admin to get it done. You just need the right VPS, a few tools, and this guide.
Get premium VPS hosting
High-performance VPS hosting that delivers unrivaled power
What is an email server?
An email server is a computer that sends, receives, and stores email messages.
Behind every email address is a server that handles the delivery and reception of your messages. If you’ve used Gmail or Outlook, their email servers did the heavy lifting. But with your own VPS, you can run your own mail transfer agent (MTA) and take back that control.
Benefits of hosting your own email server
Running your own email server comes with a handful of major advantages:
- Cost savings: No monthly per-user fees or escalating prices as your team grows.
- Full control: You choose your software, set your limits, and manage access.
- Better privacy: No third-party scanning your messages for marketing or data mining.
- More storage flexibility: Allocate VPS disk space as you want—no arbitrary mailbox limits.
- Stronger security: Configure your own firewalls, SSL certs, spam filters, and DDoS protection.
- Scalability: Add domains, addresses, or features as your needs grow.
- Custom branding: Use your own domain for professional, on-brand communication.
If you care about deliverability, reliability, and ownership, it’s worth considering.
How to set up a self-hosted email server on a Linux VPS
Setting up an email server on a Linux VPS is totally doable with some command line comfort and the right software. Here’s a step-by-step breakdown.
1. Choose a VPS
Your VPS is the foundation. You’ll want at least 1 CPU, 1–2 GB RAM, and 20 GB of disk space—but if you’re hosting multiple inboxes or large attachments, scale up from there.
Choose a VPS provider that offers root access, stable uptime, and optional backups. A static IP address is also a must to avoid spam blacklists.
2. Point your domain’s DNS to your VPS
To use your custom domain (like [email protected]), you’ll need to update the DNS:
- Set an MX (Mail Exchanger) record to point to your VPS hostname or IP.
- Add A records for the mail server (e.g., mail.yourdomain.com).
- Set up SPF, DKIM, and DMARC records for email authentication and spam prevention.
This step is crucial for deliverability.
3. Install a Linux-based mail server stack
You can piece this together manually or use a bundled solution. Some options:
- Postfix + Dovecot (DIY, flexible)
- Mail-in-a-Box (easiest, all-in-one with a script)
- iRedMail (feature-rich, good UI)
- Modoboa (open source with webmail and admin tools)
Most include SMTP, IMAP/POP3, webmail, spam filtering, and TLS support.
4. Set up SSL/TLS encryption
Use Let’s Encrypt to generate a free SSL certificate so mail clients trust your server:
sudo apt install certbot
certbot certonly --standalone -d mail.yourdomain.comThen configure Postfix and Dovecot to use those certs for secure connections.
5. Configure firewalls and ports
Allow only the necessary ports:
- 25 (SMTP)
- 143 (IMAP) and/or 110 (POP3)
- 587 (submission)
- 993 (IMAPS) and 995 (POP3S)
Use ufw or iptables to block everything else. You can also install Fail2Ban for brute-force protection.
6. Test and secure authentication
Make sure your users authenticate before sending mail. Enable SASL in Postfix and test with a mail client (like Thunderbird or Apple Mail). Add spam filtering tools like SpamAssassin or Rspamd.
7. Monitor logs and performance
Email servers can get blacklisted fast if they’re misconfigured. Watch your logs (/var/log/mail.log), monitor your IP reputation with tools like MxToolbox, and set up alerts for mail queue spikes or failures.
How to set up a self-hosted email server on a Windows VPS
Prefer Windows? The process is similar, but the software stack changes a bit. Here’s how to do it:
1. Choose a Windows VPS
Look for a VPS that comes with a Windows Server license (2016 or later), RDP access, and at least 2 GB of RAM. You’ll want similar specs as Linux, but note that Windows tends to use more memory.
2. Update DNS for your domain
Just like with Linux, point your domain’s MX and A records to your Windows VPS IP. Don’t forget SPF, DKIM, and DMARC.
3. Install a Windows-compatible mail server
Popular options include:
- hMailServer (free and widely used)
- MailEnable (free + paid versions)
- IceWarp (enterprise-grade, full suite)
hMailServer is great for most setups and supports SMTP, IMAP, POP3, and anti-spam features.
4. Set up SSL/TLS and authentication
Windows tools like Certify The Web or Win-ACME can handle Let’s Encrypt certs. Then configure your mail server to require authentication and encrypt mail connections.
5. Open firewall ports
Use Windows Defender Firewall to open the same ports as on Linux: 25, 587, 993, etc. You can also set rules to limit brute-force attempts.
6. Test mail flow and troubleshoot
Send test emails using Outlook or Thunderbird. Check that messages are sending, receiving, and not ending up in spam. Use Event Viewer to troubleshoot any issues.
Getting started with a self-hosted email server
Self-hosting your email gives you more privacy, more control, and zero monthly user fees.
Whether you prefer Linux or Windows, the first step is to set up a VPS with the resources and capabilities your email server will need—solid uptime, root access, and enough RAM and disk for your workload.
When you’re ready to upgrade your hosting to a high-quality VPS, Liquid Web can help. We’ve been leading the industry for decades, because our VPS servers are fast, cloud-based for easy scalability, and unbeatably reliable. Choose your favorite OS and the management tier that works best for you.
Click below to explore VPS hosting options or start a chat with one of our experts right now to learn more
Additional resources
VPS: A beginner’s guide →
A complete beginner’s guide to virtual private servers
What’s my IP address? →
Find your IP address with one click, using our free online tool
Managed VPS vs unmanaged VPS hosting →
How they compare so you can decide what’s best for you