Home Cloud Serevrs Set Up an SMTP Mail Server on a Windows VPS (Using hMailServer)

Set Up an SMTP Mail Server on a Windows VPS (Using hMailServer)

Last updated on Feb 13, 2025

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

  1. Go to the hMailServer official download page.

  2. Download the latest stable version.

  3. Run the installer and choose Full Installation.

  4. When prompted, select "Use built-in database engine" (for small setups).

  5. Set an Administrator Password (Store this securely!).

  6. Once installed, open hMailServer Administrator.

βœ… hMailServer is now installed!


2️⃣ Configure Your Mail Domain

  1. Open hMailServer Administrator.

  2. Click Connect β†’ Enter the Administrator password.

  3. Under Domains, click Add.

  4. Enter your domain name (e.g., yourdomain.com).

  5. Click Save.

βœ… Your domain is now set up!


3️⃣ Create an Email Account

  1. Under your domain (yourdomain.com), click Accounts β†’ Add.

  2. Enter a username (e.g., [email protected]).

  3. Set a strong password.

  4. Click Save.

βœ… Your email account is created!


4️⃣ Configure SMTP Settings

  1. Under Settings β†’ Protocols, enable SMTP.

  2. Go to Settings β†’ Advanced β†’ IP Ranges.

  3. Click Internet β†’ Enable Allow deliveries from external to local accounts.

  4. 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

  1. Open Windows Defender Firewall (Win + R, type wf.msc, press Enter).

  2. Click Advanced Settings β†’ Inbound Rules β†’ New Rule.

  3. Select Port, then click Next.

  4. Choose TCP, enter these ports:

    25, 587, 465
    
  5. Click Next, select Allow the connection, then Next again.

  6. Apply to Domain, Private, and Public networks.

  7. 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:

  1. MX Record (Handles incoming emails)

    Type: MX Name: @ Value: mail.yourdomain.com Priority: 10
    
  2. SPF Record (Prevents spam abuse)

    Type: TXT Name: @ Value: v=spf1 mx ~all
    
  3. 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

  1. Open Command Prompt (cmd).

  2. Run the following command to test SMTP:

    telnet mail.yourdomain.com 25
    
  3. 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
    
  4. 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)

  1. Enable SMTP Authentication:

    • Under Settings β†’ Protocols β†’ SMTP β†’ Require authentication for deliveries.
  2. Enable DKIM (DomainKeys Identified Mail):

    • Go to Settings β†’ Advanced β†’ Enable DKIM Signing.
  3. 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.