---
title: "Getting Started with HMailServer: A Step-by-Step Tutorial"
description: "Learn the basics of setting up and managing HMailServer for email management in this easy-to-follow tutorial."
canonical: "https://adamtheautomator.com/hmailserver/"
---

# Getting Started with HMailServer: A Step-by-Step Tutorial

> Learn the basics of setting up and managing HMailServer for email management in this easy-to-follow tutorial.

Source: https://adamtheautomator.com/hmailserver/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Getting Started with HMailServer: A Step-by-Step Tutorial](https://adamtheautomator.com/wp-content/uploads/2020/07/letters-1132703_1280-1.png)

# Getting Started with HMailServer: A Step-by-Step Tutorial

[![](https://secure.gravatar.com/avatar/9a14f10ff1b1ec7d790d34f5b559e4d3de2d31b172e6ef266dfd8b479174d97b?s=192&d=mm&r=g)June Castillote](https://adamtheautomator.com/author/june/)26 January 202111 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Email](/tag/email/)[HMailServer](/tag/hmailserver/)

Table of Contents

*   [Preparing Your Environment](#h-preparing-your-environment)
*   [Database Requirements](#h-database-requirements)
*   [Network and Port Requirements](#h-network-and-port-requirements)
*   [DNS Record Requirements](#h-dns-record-requirements)
*   [Installing hMailServer](#h-installing-hmailserver)
*   [Adding Domains to Hmailserver](#h-adding-domains-to-hmailserver)
*   [Adding Users to Hmailserver](#h-adding-users-to-hmailserver)
*   [Integrating Users with Active Directory](#h-integrating-users-with-active-directory)
*   [Adding a User from Active Directory](#h-adding-a-user-from-active-directory)
*   [Testing Email Client Setup and Mailbox Access (Unencrypted)](#h-testing-email-client-setup-and-mailbox-access-unencrypted)
*   [Securing Client Connections with SSL Certificates](#h-securing-client-connections-with-ssl-certificates)
*   [Importing an SSL Certificate](#h-importing-an-ssl-certificate)
*   [Assigning an SSL Certificate to TCP/IP Ports](#h-assigning-an-ssl-certificate-to-tcp-ip-ports)
*   [Testing Email Client Setup and Mailbox Access (Encrypted)](#h-testing-email-client-setup-and-mailbox-access-encrypted)
*   [Configuring an SMTP Smart Host for External Mail Delivery in Hmailserver](#h-configuring-an-smtp-smart-host-for-external-mail-delivery-in-hmailserver)
*   [Testing External Email Delivery](#h-testing-external-email-delivery)
*   [Conclusion](#h-conclusion)
*   [Further Reading](#h-further-reading)

The phrase “mail server” is almost synonymous with the name _Microsoft Exchange_. You don’t have to choose Microsft Exchnage. Instead, you can set up the free mail server called hmailserver!

And if you’re interested in trying it out, then you’re in luck! Because in this article, you will learn about the basic requirements and how to install hMailServer and set it up as a mailbox and SMTP server.

By the end of this article, you will have learned how to perform basic configuration tasks such as adding domains, users, SSL certificates, and using SMTP smart host for external email delivery.

## Preparing Your Environment

This article will be a walkthrough about installing and configuring _hMailServer_ on a single server. If you plan to follow along with the examples, you will need to prepare some requirements.

*   A Windows Server 2016 computer.
*   Download the latest copy of _hMailServer_ from this _[link](https://www.hmailserver.com/download)._
*   An email client used for accessing email accounts. In this article, _[Mozilla Thunderbird](https://www.thunderbird.net/en-US/)_ will be used.
*   (Optional) [Active Directory](https://adamtheautomator.com/tag/active-directory/). This is only needed if you will create hMailServer email users based on Active Directory users. Otherwise, you can still create email users without it.
*   (Optional) A valid SSL certificate to encrypt email client connections. You can get an SSL certificate for free from _[Let’s Encrypt](https://letsencrypt.org/)_. The certificate must be in PEM format. It’s okay if you don’t have this, hMailServer will still work without encryption.

### Database Requirements

hMail Server can be installed with a built-in database (Microsoft SQL Server Compact Edition (CE)).  It is suitable for testing, small deployment, or personal installations.

However, if you plan to use hMailServer commercially or in production, you will need an external database instead. If you choose to use an external database, the following database engines are supported by hMailServer.

*   Microsoft SQL Server 2000 or later
*   MySQL
*   PostgreSQL

In this article, only the built-in database will be used.

### Network and Port Requirements

The following ports must be allowed in your network. Depending on your planned usage (i.e., IMAP only, no POP3), you may opt to leave some ports that will not be used.

*   25 (SMTP)
*   465 (SMTP SSL/TLS)
*   587 (SMTP Submission)
*   110 (POP3)
*   995 (POP3 SSL/TLS)
*   143 (IMAP)
*   993 (IMAP SSL/TLS)

### DNS Record Requirements

Mail systems rely heavily on DNS for email delivery to function correctly. So proper DNS records must be in place, both for internal and external resolution.

To keep things simple, in this article:

*   Only one DNS (A) record will be used for the internal DNS – which is the FQDN of the server where hMail Server will be installed. In this article, the server address is _hmail1.lzex.cf_.

![Sample DNS (A) record for the hMailServer](https://adamtheautomator.com/content/images/2020/06/Untitled-1.png)

Sample DNS (A) record for the hMailServer

(Optional) Two DNS records will be used for the external DNS.

![DNS (MX) record](https://adamtheautomator.com/content/images/2020/06/Untitled--1--1.png)

DNS (MX) record

*   An MX record that will be used for mail delivery pointed to the external address of the hMailServer.

![DNS (CNAME) Record](https://adamtheautomator.com/content/images/2020/06/Untitled--2--1.png)

DNS (CNAME) Record

*   A CNAME record that will be used for client connection (IMAP, POP3, SMTP), also pointed to the external address of the hMailServer.

> _For a complete list of system requirements, visit the [hMailServer’s System Requirement](https://www.hmailserver.com/documentation/latest//latest/?page=system_requirements) page._

## Installing hMailServer

To perform an hMailServer installation is a fairly straightforward process. It is a wizard-based installation type, which means that you will only be clicking on buttons.

1.  Locate the installation file that you’ve downloaded and then launch it. Then, click **Next** on the welcome page.
2.  In the **License Agreement** page, you must accept the terms. Click **Next.**
3.  Next, either select a custom path or leave the default path where the hMailServer will be installed. Then, click **Next.**
4.  You are not presented with two options; **Full Installation** or **Custom**. Select Full Installation to install both the server and admin tools. Then click **Next.**
5.  Next, choose the database server type. In this article, the built-in database engine will be used. Then click **Next**.
6.  Click **Next** on the **Select Start Menu Folder** page to leave it to its default value.
7.  Next, you need to specify a password for the hMailServer instance that you are installing. Make sure to remember this password.
8.  You’ll be shown a summary of the installation options you chose. Click on the **Install** button to being the installation process.
9.  Wait for the installation to complete, then click **Finish**.
10.  On the **Connect** window, select the instance of hMailServer and click on **Connect.** Enter your password when prompted, then click **OK.**

![hMailServer Instance on the Connect Window](https://adamtheautomator.com/content/images/2020/06/Untitled--12--1.png)

hMailServer Instance on the Connect Window

And that’s it! You have successfully installed your first hMailServer.

![Successfully Added hMailServer](https://adamtheautomator.com/content/images/2020/06/Untitled--13--1.png)

Successfully Added hMailServer

## Adding Domains to Hmailserver

Just installing hMailServer is not enough to make it usable. You still need to configure things like domain(s), users, ports, and relay settings.

Before you can add users, you must first add an email domain. This must be the email domain that you’ve prepared and plan to use for your email address.

To add a new domain, in the hMailServer Administrator (admin console window), click on **Domains**. You will notice that the list of domains is empty – which is to be expected. Click on **Add**.

![Adding Domain to the hMailServer](https://adamtheautomator.com/content/images/2020/06/Untitled--14--1.png)

Adding Domain to the hMailServer

Next, type in your domain in the **Domain** box. Make sure that the **Enabled** checkbox is checked, then click **Save**.

Note that there are more configurations available for the domain, like the message size limits and default signatures. Feel free to configure those if you prefer.

![Domain Configurations to the hMailServer Window](https://adamtheautomator.com/content/images/2020/06/Untitled--15--1.png)

Domain Configurations to the hMailServer Window

After clicking on **Save**, as you can see below, a new domain has been created and added to the **Domains** list.

![Saving Domain to the hMailServer Window](https://adamtheautomator.com/content/images/2020/06/Untitled--16--1.png)

Saving Domain to the hMailServer Window

## Adding Users to Hmailserver

Now that the domain is added, email accounts can now be added under that domain.

To add a new account, click on the **Account** folder under the domain. Then, click on the **Add** button on the right.

![Adding User to the hMailServer Window](https://adamtheautomator.com/content/images/2020/06/Untitled--17--1.png)

Adding User to the hMailServer Window

Go to the **Advanced** tab and specify the **First name** and **Last name** of the new user.

![Inserting First Name and Last Name to the hMailServer Window](https://adamtheautomator.com/content/images/2020/06/Untitled--18--1.png)

Inserting First Name and Last Name to the hMailServer Window

Then, go to the **General** tab, type in the **address** and **password** of the account you are creating. It is also recommended to set a maximum size for the user’s mailbox. When you’re done, click on **Save**.

![Inserting Address and Password to the hMailSever Window](https://adamtheautomator.com/content/images/2020/06/Untitled--19--1.png)

Inserting Address and Password to the hMailSever Window

As you can see from the image below, the new email account has been created.

![New Email Added to the hMailServer Window](https://adamtheautomator.com/content/images/2020/06/Untitled--20--1.png)

New Email Added to the hMailServer Window

## Integrating Users with Active Directory

You can modify existing users or create new users and connect them with Active Directory. Integrating an hMailServer user with Active Directory ensures that your users can use their domain credentials to log in to their hMailServer accounts.

Suppose that you have already created the account and want to integrate it with AD, follow these steps.

First, locate and edit the account in the hMailServer admin console. Then, go to the **Active Directory** tab.

Next, put a check on the **Active Directory account** box. Enter the active directory domain in the **Domain** box, and the user name in the **User name** box. When you’re done editing, click **Save**.

![Inserting Domain to the Active Directory Box](https://adamtheautomator.com/content/images/2020/06/Untitled--21--1.png)

Inserting Domain to the Active Directory Box

As you can see from the image above, the hMailServer user has a corresponding Active Directory account. The user can now use his AD domain credentials to access his hMailServer email account.

## Adding a User from Active Directory

Instead of creating a user and then integrate it with Active Directory, there is also an option to directly create a user in hMailServer from an existing Active Directory user object.

From the admin console, right-click on the **Accounts** folder —> click on **Add AD Account**.

![Adding AD Account to the Active Directory Box](https://adamtheautomator.com/content/images/2020/06/Untitled--22--1.png)

Adding AD Account to the Active Directory Box

Next, select the domain from the dropdown list. In this example, there’s only one domain available. Then, from the list of users, select the user that you want to create an email account for. Click **OK**.

![Adding User to the Active Directory Box](https://adamtheautomator.com/content/images/2020/06/Untitled--23--1.png)

Adding User to the Active Directory Box

As you can see from the screenshot below, a new user has been created in hMailServer based on the Active Directory user account _vmadmin_.

![Successfully Added Domain to the Active Directory](https://adamtheautomator.com/content/images/2020/06/Untitled--24--1.png)

Successfully Added Domain to the Active Directory

## Testing Email Client Setup and Mailbox Access (Unencrypted)

The hMailServer configuration you’ve done so far is enough to work for internal and external email access.

In this example, the specific email client being used is _Mozilla Thunderbird_. Feel free to use any other email clients that support IMAP, POP3, and SMTP configurations.

The mail client configuration below is specific to this example. Take note of the server hostname, port number, and SSL values.

![Email Client Configuration](https://adamtheautomator.com/content/images/2020/06/Untitled--25--1.png)

Email Client Configuration

As you can see from the screenshot above, the **SSL** values for incoming and outgoing mail server are **None**. When you click **Done**, you will get a warning message that the incoming and outgoing settings are not using any encryption, as shown in the image below.

![Warning Message on Encryption](https://adamtheautomator.com/content/images/2020/06/Untitled--26--1.png)

Warning Message on Encryption

To proceed with the account setup, check the box that says **I understand the risks**. Click **Done**.

Once the account setup is done, the next test is to send a test email to the same account and confirm that the email was sent and received. The screenshot below shows that the test email was delivered.

![Sending Email and Confirming Receipt of Email](https://adamtheautomator.com/content/images/2020/06/Untitled--27--1.png)

Sending Email and Confirming Receipt of Email

## Securing Client Connections with SSL Certificates

In the previous section, you’ve seen that the current hMailServer setup so far does not include encryption for client connections in IMAP, POP3, and SMTP. Needless to say, adding encryption to your mail client connectivity for security and protection.

In this section, you’ll learn how to add an SSL certificate for authentication and encryption and assign the certificate to POP3, IMAP, and SMTP.

Before you proceed, you must have the PEM format certificate file and keyavailable. In this example, the certificate files are located in _c:\\certs._

![PEM Format Certificate File](https://adamtheautomator.com/content/images/2020/06/Untitled--28--1.png)

PEM Format Certificate File

### Importing an SSL Certificate

Back in the admin console, go to **Settings —> Advanced —> SSL Certificates**. It is expected that the list of certificates is empty. Click on **Add**.

![Importing an SSL Certificate](https://adamtheautomator.com/content/images/2020/06/Untitled--29--1.png)

Importing an SSL Certificate

Next, specify a **Name** that you want your certificate to be identified as. This can be any name, but it is recommended to use the certificate’s subject name instead. Then, provide the location of the **Certificate file** and **Private key** file. Click on **Save.**

![Setting Up the Name, Location, and Private Key File](https://adamtheautomator.com/content/images/2020/06/Untitled--30--1.png)

Setting Up the Name, Location, and Private Key File

The new SSL certificate will be added to the list of certificates that are available for hMailServer’s use.

![Successfully Added SSL Certificate to the hMailServer Admin Window](https://adamtheautomator.com/content/images/2020/06/Untitled--31--1.png)

Successfully Added SSL Certificate to the hMailServer Admin Window

Now that the SSL certificate is added, you can start assigning it to the protocol ports.

### Assigning an SSL Certificate to TCP/IP Ports

Go to the **TCP/IP Ports** folder. You should see a list of ports already configured. Click on **Add** to create a new TCP/IP port binding.

![TCP/IP Ports Folder](https://adamtheautomator.com/content/images/2020/06/Untitled--32--1.png)

TCP/IP Ports Folder

Create a new entry for IMAP with these settings.

*   Protocol: _IMAP_
*   TCP/IP address: _0.0.0.0_
*   TCP/IP port: _993_
*   Connection security: _SSL/TLS_
*   SSL Certificate: _select your certificate from the list_

The new entry should look similar to what’s shown in the screenshot below.

![Creating New Entry for IMAP](https://adamtheautomator.com/content/images/2020/06/Untitled--33--1.png)

Creating New Entry for IMAP

You may be prompted to restart the hMailServer, do not restart yet because you will still create the entries for POP3 and SMTP.

Now, follow the repeat the same procedure above to create the _POP3 TCP/IP_ secured port.

Use the below values for the new **POP3 TCP/IP** port.

*   Protocol: _POP3_
*   TCP/IP address: _0.0.0.0_
*   TCP/IP port: _995_
*   Connection security: _SSL/TLS_
*   SSL Certificate: _select your certificate from the list_

![New \*POP3 TCP/IP \*\*\*\*\* Port](https://adamtheautomator.com/content/images/2020/06/Untitled--34--1.png)

New POP3 TCP/IP Port

Lastly, create the new SMTP port with these settings below.

*   Protocol: _SMTP_
*   TCP/IP address: _0.0.0.0_
*   TCP/IP port: _465_
*   Connection security: _SSL/TLS_
*   SSL Certificate: _select your certificate from the list_

![New SMTP Port Settings](https://adamtheautomator.com/content/images/2020/06/Untitled--35--1.png)

New SMTP Port Settings

This time, when prompted to restart the hMailServer, click **Yes.**

![Restarting the hMailServer](https://adamtheautomator.com/content/images/2020/06/Untitled--36--1.png)

Restarting the hMailServer

You have successfully created the new TCP/IP ports secured with an SSL certificate. You should now see a list similar to the screenshot below.

![Successfully Created TCP/IP Ports](https://adamtheautomator.com/content/images/2020/06/Untitled--37--1.png)

Successfully Created TCP/IP Ports

At this point, it is up to you to decide if you want to delete the old TCP/IP port entries.

## Testing Email Client Setup and Mailbox Access (Encrypted)

Now that an SSL certificate has been installed in hMailServer, go back to your email client and reconfigure your email account to use the following settings, as shown in the screenshot below.

Take note of the **Port** and **SSL** values having changes to the new TCP/IP port configuration that you created in the previous section. Below is where you will set up both incoming (IMAP) and outgoing (SMTP authentication).

![Port and SSL Values](https://adamtheautomator.com/content/images/2020/06/Untitled--38--1.png)

Port and SSL Values

After configuring the email account, you should be able to access the mailbox and send/receive emails using the new IMAP and SMTP ports.

Also, the warning message about the incoming mail server and outgoing mail server settings being unencrypted is no longer displayed.

## Configuring an SMTP Smart Host for External Mail Delivery in Hmailserver

By default, hMailServer uses DNS-MX lookup to determine where emails to external domains must be delivered. This means that if port 25 is allowed in your network/firewall, hMailServer can attempt to deliver external messages to the intended destination.

This default setup could be enough for some organizations, but most organizations are using a perimeter SMTP service. Perimeter email servers may be cloud hosted or on-premise. These perimeter mail services are, most of the time, provide email hygiene services as well.

If you have such services and would like to utilize them, you can configure hMailServer to use your perimeter mail server as a smart host for delivering external messages.

To configure an SMTP relayer or smart host for your hMailServer, follow these steps.

In the hMailServer admin console, go to **Settings —> Protocols —> SMTP.** Next, go to the **Delivery of e-mail** tab.

Then, enter the name of your hMailServer that is published in your public [DNS record](https://adamtheautomator.com/powershell-dns/). In this example, the public-facing hostname of the email server is _hmail1.lzex.cf_.

Next, fill out the **SMTP Relayer** settings with the values of your SMTP smart host. In this example, hMailServer will be configured to use _[SendGrid Email Delivery Service](https://sendgrid.com/)_ as the smart host.

![SMTP Relayer Service ](https://adamtheautomator.com/content/images/2020/06/Untitled--39--1.png)

SMTP Relayer Service

Don’t forget to click **Save** once you’re done supplying the values required.

## Testing External Email Delivery

To test that the SMTP smart host configuration is working, the best way

The best way to confirm if the SMTP smart host configuration is working is by:

*   Sending an email to an external domain (e.g., [gmail.com](http://gmail.com)) and confirm that the message was delivered.
*   Reply to the email and confirm that the reply was received.

In this example, a message will be sent from the hMailServer user [jdoe@lzex.cf](mailto:jdoe@lzex.cf) to a [gmail.com](http://gmail.com) recipient.

![Sending Message from hMailServer to Gmail](https://adamtheautomator.com/content/images/2020/06/Untitled--40--1.png)

Sending Message from hMailServer to Gmail

As you can see from the screenshot of the email below, the message was received by the [gmail.com](http://gmail.com) recipient, and the reply was delivered back to the hMailServer user mailbox.

![Successfully Sent Message to Gmail](https://adamtheautomator.com/content/images/2020/06/Untitled--41--1.png)

Successfully Sent Message to Gmail

## Conclusion

You’ve made it to end, congratulations!

In this article, you’ve learned about the basic requirements for building a successful hMailServer email system. Then, you’ve learned how to install hMailServer on a single machine.

You’ve seen the step-by-step instructions on how to configure hMailServer to have a new domain and add new users from scratch or from existing Active Directory accounts. Moreover, you’ve learned the difference between the encrypted and unencrypted server connections and how to use an SSL certificate to secure TCP/IP ports for POP3, SMTP, and IMAP.

What you’ve learned here is just the basics of configuring a functional hMailServer mail server. There are many more customization and configuration that can be done with hMailServer that could not be covered in this article.

Some of the advanced configurations include attaching a spam filter, installing a webmail server, and scripting. It’s up to you now if you want to pursue learning more about hMailServer and improve your skills.

## Further Reading

*   **_[hMailServer Documentation](https://www.hmailserver.com/documentation)_**
*   **_[What Is DNS? | How DNS Works](https://www.cloudflare.com/learning/dns/what-is-dns/)_**
*   **_[Email Protocols – POP3, SMTP and IMAP Tutorial](https://www.siteground.com/tutorials/email/protocols-pop3-smtp-imap/)_**
*   **_[How To Get Started Using OpenSSL With PowerShell](https://adamtheautomator.com/openssl-windows-10/)_**
*   **_[Send-MailMessage: The PowerShell Way to Send Email](https://adamtheautomator.com/send-mailmessage/)_**

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fhmailserver%2F&text=Getting%20Started%20with%20HMailServer%3A%20A%20Step-by-Step%20Tutorial)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fhmailserver%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fhmailserver%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/07/featured_image-4.png)

### [Migrate from EWS to Microsoft Graph API](/migrate-ews-microsoft-graph-api/)

Move EWS mailbox automation to Microsoft Graph with a practical inventory, permissions, PowerShell SDK, and cutover validation checklist.

![](https://adamtheautomator.com/wp-content/uploads/2026/06/featured_image-21.png)

### [Automate SOC 2 Compliance with PowerShell](/automate-soc-2-compliance-powershell/)

A comprehensive walkthrough on using PowerShell and Azure Policy as Code to automate evidence collection and enforce SOC 2 compliance controls across enterprise cloud environments.

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
