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:<[email protected]> RCPT TO:<[email protected]> 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.