Build a Mail Server with hMailServer on Windows
If you run a website on your Windows Server, you probably also want to be able to receive email. There is an application called hMailServer that allows you to manage your mail server with a simple GUI. In this tutorial, we're going to install hMailServer and test receiving email.
Prerequisites
- Verify the server's outbound port status.
Step 1: Installing hMailServer
The first thing we need to do is to download hMailServer. The downloads are available on the offical site. Download the latest version.
Launch the setup when you've downloaded the .exe
file. Click "Next" and agree to the license agreement. Select "Full installation", because we're not going to manage another server, but we're going to use this server as the mail server.
Click "Install" to proceed. The installation takes about 20 seconds.
Step 2: Adding a domain
When you start hMailServer, you will see that there's only one server that you can connect to: localhost
. This is the mail server. Double-click the mail server to connect to it.
When you connect for the first time, you will see that no domains have been added yet. Add one by clicking "Add domain...". You will be able to receive email on that domain name. Now enter your domain name and save.
You will see that your domain name has been added to "Domains" in the sidebar.
Step 3: Adding an email account
Now that we have added the domain, we are able to add an email account. Click "Accounts" in the sidebar. All email addresses will then appear. A new account can be added by clicking "Add...".
The address is the first part of the email address you're going to create. Say you want to add "info@example.com" - you would input "info" into the address field. Enter your password where it says "<< Encrypted >>". You can set the maximum disk space that an email address can use. This is specified with the "Maximum size" option. Note that this unit is in MB. Click "Save".
Step 4: Configuring hMailServer
In order to ensure that hMailServer works, there are a few things we need to do.
First, go to "Settings -> Protocols -> SMTP -> Delivery of e-mail". You need to use your ISP's SMTP relayer if you have a dynamic IP. If not, you can leave this field empty.
Step 5: Setting your DNS
In order for your mail to even arrive at the mail server, you need to add an MX record to your domain. This process varies depending on the registrar you used to purchase your domain. If you're not sure how to add an MX record, contact your registrar.
Step 6: Opening your firewall
You need to open some ports in your firewall in order for the mail server to be able to send and receive mail. These ports are:
- 25 and 110 for SMTP and POP
- 143 for IMAP
Step 7: Accessing your email
At this point, we have a mail server setup. To access your mail server, you can setup a web mail client, or an application on your computer such as Outlook or Thunderbird. If you use an application on your computer, the username should be your email address and the authentication type is "password".