Personal Email Server on Windows 7 with hMailServer

Due to the fact that the number of emails that can be sent per day via the Amazon SES SMTP is limited, I decided to run my own email server on a desktop. However, it’s unfortunate that the IIS 7.0 in Windows 7 does not have SMTP server installed by default. After doing some google searches, I came to an online forum about SMTP service in Windows 7. There is where I got to know more about hMailServer, a free email server for Windows.

The good thing about hMailServer is that it is very easy to install and configure.

Installation

During the installation, we will be asked to select the components that we would like to install. Here, we will proceed with the default option, the Full Installation, which contains both server and administrative tools.

Select components.

Select components.

After that, we will have to choose a database server type. We can chose either built-in database engine (MS SQL Compact) or external database engine (MS SQL, MySQL or PostgreSQL). According to the hMailServer documentation, built-in database engine option is only suitable for personal use, instead of commercial use because the Microsoft SQL Server Compact Edition comes with hMailServer is limited to only 4GB.

Select database server type.

Select database server type.

During the installation, an admin account will be created. The admin will be in charge of managing hMailServer configuration later. Thus, we will need to enter a password for the admin account.

Before the installation process is completed, we will need to enter the password that we assigned to the admin account earlier before we can proceed.

There is a need to re-enter password before the completion of installation.

There is a need to re-enter password before the completion of installation.

If the option of using external database engine was chosen earlier during the installation, we will need to go through another step of seting up the hMailServer database. We are basically given three options to choose: MS SQL Server, MySQL, and PostgreSQL. The following screenshot shows the database created in MS SQL Server after finishing the database setup.

Tables created and used in hMailServer.

Tables created and used in hMailServer.

Configuration

After the database is created, we would be able to connect to the hMailServer by choosing the correct host and user. Here, we need to again key in the password that we used earlier.

Choose an account to connect to hMailServer

Choose an account to connect to hMailServer

We will then be brought to the hMailServer Administrator window where we can continue to configure the settings in hMailServer.

Firstly, we will create a domain and then add user accounts to the domain.

hMailServer Domain and Account

hMailServer Domain and Account

Secondly, we will choose SMTP as the only protocol that we want to use in hMailServer.

Three protocols are available in hMailServer: SMTP, POP3, and IMAP.

Three protocols are available in hMailServer: SMTP, POP3, and IMAP.

Some Internet Service Providers (ISPs) block outgoing traffic on port 25, which will be used for email. Thus, to test if the port 25 is blocked or not, we just need to telnet mail.hmailserver.com 25 on command line. If it is not blocked, a message “220 mail.hmailserver.com ESMTP” will be shown.

Port 25 is not blocked!

Port 25 is not blocked!

However, since the Telnet client has been removed in recent versions of Windows, we will need to add it back in Windows Features before we can try out the command above. Otherwise we will get an error message saying telnet is not recognized as an internal or external command.

Switching on telnet client in Windows Features.

Switching on telnet client in Windows Features.

Thirdly, the logging feature, which is by default disabled, needs to be switched on. The log gives very useful information to check if the emails are sent successfully.

Logging Configuration

Logging Configuration

Finally, to prevent this personal email server vulnerable to spam, we should configure the hMailServer IP range. By default, the option Internet has a IP range from 0.0.0.0 to 255.255.255.255. This has to be disabled otherwise hMailServer will promt a critical configuration warning at the Status page.

Internet IP Range

Internet Option IP Range

Experiment

After doing all these, the email server should be ready to go. However, when I check the log, there are messages as follows.

“Our system has detected an unusual rate of unsolicited mail originating from your IP address. To protect our users from spam, mail sent from your IP address has been blocked. Please visit http://www.google.com/mail/help/bulk_mail.html to review our Bulk Email Senders Guidelines.” (for gmail.com email)

“Sending unsolicited commercial or bulk e-mail to Microsoft’s computer network is prohibited. Other restrictions are found at http://privacy.microsoft.com/en-us/anti-spam.mspx.” (for hotmail.com email)

“Connections not accepted from IP addresses on Spamhaus XBL; see http://postmaster.yahoo.com/errors/550-bl23.html” (for yahoo.com email)

Hence, now I have no choice but to use the SMTP Relayer on hMailServer to help sending the email successfully.

SMTP Relayer

SMTP Relayer

Edit

After reading Aaron’s comment, I looked into the SMTP authentication portion and realized a new way to solve the problem above. Please click here to read more.

About these ads

About Chun Lin
A programmer who likes to drink Milo and works on personal programming projects after work.

4 Responses to Personal Email Server on Windows 7 with hMailServer

  1. Aaron Watson says:

    The reason you needed to set up a relay is likely that you didn’t set up SMTP authentication under protocols. Without authentication, your server becomes an open relay meaning it can be used by anybody to send email without needing a user account on your mail server.

    By setting up authentication, you force users to supply a username/password to use your SMTP (Eg. when you enter user settings for your mail client).

    When you use Google as an SMTP relay, they may be filtering the spam for you, but your server may still be an open relay transmitting through them. Eg, no user authentication is required for your server and you give credentials to send through Google. Since Google becomes the point of origin, any spam gets traced back to them first and they’re probably filtering it on their network.

  2. Pingback: Successfully Sent An Email via hMailServer | cuteprogramming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: