If you need to send and receive emails from your Windows VPS, setting up an SMTP mail server is essential. This guide will show you how to install and configure hMailServer, a free and lightweight mail server solution.
📌 Prerequisites
-
A Windows Server VPS (2016, 2019, or 2022) from VolticHost
-
Administrator access
-
A domain name (e.g.,
yourdomain.com
) -
Port 25 open (Some providers block SMTP—check with Voltichost Support)
1️⃣ Download and Install hMailServer
-
Go to the hMailServer official download page.
-
Download the latest stable version.
-
Run the installer and choose Full Installation.
-
When prompted, select "Use built-in database engine" (for small setups).
-
Set an Administrator Password (Store this securely!).
-
Once installed, open hMailServer Administrator.
✅ hMailServer is now installed!
2️⃣ Configure Your Mail Domain
-
Open hMailServer Administrator.
-
Click Connect → Enter the Administrator password.
-
Under Domains, click Add.
-
Enter your domain name (e.g.,
yourdomain.com
). -
Click Save.
✅ Your domain is now set up!
3️⃣ Create an Email Account
-
Under your domain (
yourdomain.com
), click Accounts → Add. -
Enter a username (e.g.,
[email protected]
). -
Set a strong password.
-
Click Save.
✅ Your email account is created!
4️⃣ Configure SMTP Settings
-
Under Settings → Protocols, enable SMTP.
-
Go to Settings → Advanced → IP Ranges.
-
Click Internet → Enable Allow deliveries from external to local accounts.
-
Go to Settings → Protocols → SMTP:
-
Delivery of Email: Set localhost as the default SMTP Relayer.
-
Maximum connections: 10 (adjust based on usage).
-
Connection security: Enable STARTTLS (optional but recommended).
-
✅ Your mail server can now send emails!
5️⃣ Open SMTP Ports in Windows Firewall
-
Open Windows Defender Firewall (
Win + R
, typewf.msc
, press Enter). -
Click Advanced Settings → Inbound Rules → New Rule.
-
Select Port, then click Next.
-
Choose TCP, enter these ports:
25, 587, 465
-
Click Next, select Allow the connection, then Next again.
-
Apply to Domain, Private, and Public networks.
-
Name the rule SMTP Ports and click Finish.
✅ Your server can now send and receive emails!
6️⃣ Configure DNS (MX and SPF Records)
To receive emails, configure MX and SPF records in your domain's DNS settings:
-
MX Record (Handles incoming emails)
Type: MX Name: @ Value: mail.yourdomain.com Priority: 10
-
SPF Record (Prevents spam abuse)
Type: TXT Name: @ Value: v=spf1 mx ~all
-
Reverse DNS (PTR Record)
- Contact VolticHost Support to set up reverse DNS for your mail server IP.
✅ Your domain is now correctly configured for email!
7️⃣ Test Your Email Server
Send a Test Email
-
Open Command Prompt (cmd).
-
Run the following command to test SMTP:
telnet mail.yourdomain.com 25
-
If successful, send an email manually:
HELO yourdomain.com MAIL FROM:<admin> RCPT TO:<your-email> DATA Subject: Test Email This is a test email from my SMTP server. . QUIT
-
Check if the email arrives in your Gmail or other inbox.
✅ Your mail server is working!
8️⃣ Secure Your Mail Server (Prevent Spam and Abuse)
-
Enable SMTP Authentication:
- Under Settings → Protocols → SMTP → Require authentication for deliveries.
-
Enable DKIM (DomainKeys Identified Mail):
- Go to Settings → Advanced → Enable DKIM Signing.
-
Use an SMTP Relay (Optional, if emails get blocked):
- Under Settings → Protocols → SMTP Relayer, enter an external SMTP service like SendGrid or Postmark.
✅ Your email server is now secured!
🎉 Conclusion
You've successfully set up an SMTP mail server on your Windows VPS using hMailServer! Your VPS can now send and receive emails securely. 🚀
For more assistance, contact VolticHost Support.