hMailServer For Windows Installation Guide

hMailServer is a free e-mail server for Microsoft Windows. It supports all the common e-mail protocols such as, SMTP, POP3 and IMAP.

If you are on a tight budget to purchase a commercial mail server, this is a good choice of having a reliable mail server that cost virtually nothing, except your effort you put to configure it.

I wrote this installation guide based on my experience in setting up a workable system.


These prerequisites are necessary to have if you want a web mail that works with hMailServer.

1. Apache
2. PHP
3. MySQL
4. Perl

hMailServer Installation

Stop the SMTP Service in IIS (Internet Information Services). It will clash with hMailServer because both are using the same port 25.

Download the latest hMailServer from

Launch the installer and follow the installation instruction.

Enter a password for hMailServer Administrator.

Launch the hMailServer Administrator.

Click Settings > Protocols > SMTP, and select the “Delivery of email” tab.

Enter the Host name and click Save.

Right-click Domains menu, then click Add.

Enter a new Domain name. Eg.

Enter a catch-all address. Eg.

Click Save.

Expand the newly created Domain and click “Add account”.

Enter an Account Address and Password.

Click Save.

Repeat the steps to create additional accounts.

Apache Installation

Download the latest Apache 1.3.x from

Launch the installer and follow the installation instruction.

Edit httpd.conf

Enter an e-mail address in ServerAdmin.

Enter a ServerName.

Modify DocumentRoot if necessary to point to the root directory. Eg. D:/www
Note the forward slash “/”.

The default root directory is at C:/Program Files/Apache Group/Apache/htdocs, or in a different folder location where the Apache program is installed.

Add: index.php to DirectoryIndex. Place it before index.html.

Add: LoadModule php5_module “C:/php/php5apache.dll”

Uncomment: LoadModule vhost_alias_module modules/

Uncomment: LoadModule rewrite_module modules/

Add: AddModule mod_php5.c

Uncomment: AddModule mod_vhost_alias.c

Uncomment: AddModule mod_rewrite.c

Save the changes.

Start Apache Service and verify there is no error.

PHP + PEAR Installation

Download the latest PHP 5.2.x Zip Package (not installer package) from

Unzip it to C:\PHP folder.

Rename php.ini-recommended to php.ini and copy it to C:\Windows folder.

Edit C:\Windows\php.ini with the following:

short_open_tag = On
max_execution_time = 60
post_max_size = 20M
upload_max_filesize = 20M
extension_dir = “C:\PHP\ext”


Copy libeay32.dll and libmysql.dll from C:\PHP to C:\Windows\System32 folder.

Launch the Windows command prompt and enter C:\PHP\go-pear.bat to install PEAR.

Follow the installation instruction and keep the default settings.

Download the PEAR DB package from

Unzip it into C:\PHP\PEAR folder. Make sure the DB.php is in that folder.

Restart Apache and verify there is no error.

Create a phpinfo.php with the following code and place it in the root directory.

echo phpinfo();

Browse the phpinfo.php in web browser. PHP installation is successful if information is displayed.

MySQL Installation

You have an option to install the MySQL automatically when the hMailServer is installed, unless you want to have a separate MySQL installation.

Download the latest MySQL Community Server 5.x from

Launch the installer and follow the installation instruction.

Start MySQL Service.

Download the latest MySQL Administrator GUI Tools from

Launch the installer and follow the installation instruction.

Launch the MySQL Administrator.

Click Catalogs and create a New Schema.

Enter a Schema name: eg. squirrelmail

Click User Administration and Add New User.

Enter a new MySQL User name. eg. squirreluser

Enter a Password. Eg. squirrelpassword

Click Apply Changes.

Right-click the squirreluser and Add Host.

Enter a Host as localhost.

Select localhost and select the Schema Privileges tab.

Select squirrelmail and move SELECT, INSERT, UPDATE and DELETE to Assigned Privileges.

Click Apply Changes.

Launch MySQL Command Prompt and login into MySQL.

********* Skip this section of the above is done ************
CREATE DATABASE squirrelmail;

GRANT select,insert,update,delete ON squirrelmail.*
TO squirreluser@localhost IDENTIFIED BY ‘squirrelpassword’;

USE squirrelmail;

CREATE TABLE address (
owner varchar(128) DEFAULT ” NOT NULL,
nickname varchar(16) DEFAULT ” NOT NULL,
firstname varchar(128) DEFAULT ” NOT NULL,
lastname varchar(128) DEFAULT ” NOT NULL,
email varchar(128) DEFAULT ” NOT NULL,
label varchar(255),
PRIMARY KEY (owner,nickname),
KEY firstname (firstname,lastname)

CREATE TABLE userprefs (
user varchar(128) DEFAULT ” NOT NULL,
prefkey varchar(64) DEFAULT ” NOT NULL,
prefval blob DEFAULT ” NOT NULL,
PRIMARY KEY (user,prefkey)


PERL Installation

Download the latest ActivePerl 5.10.x from

Launch the installer and follow the installation instruction.

SquirrelMail Installation

Download the latest SquirrelMail 1.4.x from

Unzip it into the web root C:\path to apache\htdocs or in a sub-folder. Eg C:\path to apache\htdocs\ squirrelmail\ and you will access it through

Create a directory C:\Data and within that directory create two more directories C:\Data\Data and C:\Data\Attachments. Specify these as your Data and Attachment directories.

Edit functions/db_prefs.php and replace var $default with the following:

var $default = Array(‘chosen_theme’ => ‘../themes/default_theme.php’,
‘show_html_default’ => ‘1’,
‘language’ => ‘en_US’,
‘use_javascript_addr_book’ => ‘1’,
‘left_size’ => ‘140’,
‘left_refresh’ => ‘3600’,
‘show_username’ => ‘1’,
‘show_username_pos’ => ‘top’,
‘order1’ => ‘1’,
‘order2’ => ‘2’,
‘order3’ => ‘3’,
‘order4’ => ‘5’,
‘order5’ => ‘4’,
‘order6’ => ‘6’);

Edit squirrelmail/src/login.php and change the wording of “Name:” to “Email Address:”.

In Windows command prompt, access into C:\path to\squirrelmail\config folder.

Type perl

Choose hmailserver

1. Organization name : YourCompany WebMail
2. Organization Logo : /images/yourcompanylogo-100.gif
3. Org. Logo Height/Width : 100/100
4. Organization title : YourCompany WebMail (v$version)
7. Provider link :
8. Provider name : YourCompany

1. Domain :

15. Default Unseen Type : 2

1. Data directory : C:/Data/Data
2. Attachment directory : C:/Data/Attachments
5. Usernames in lower case : true
7. Hide SM attributions : true
11. Allow server-side sorting : false
( Note: Item 4.1 and 4.2 need to be forward slash “/”)

2. Use Javascript Address Book Search : True

1. DSN for address book :
3. DSN for preferences :

Now, Save and quit the config program

Start Apache Service and verify there is no error.



ClamWin is an open source anti-virus scanning and detection engine that will integrated seamlessly with hMailServer.

Download the latest ClamWin 0.93.x installer from

Launch the installer and follow the installation instruction.

Launch hMailServer Administrator.

Expand the Settings > AntiVirus menu.

Set the desired options in General tab.

Click ClamWin tab and enable “Use ClamWin” checkbox.

Click the AutoDetect button to locate the ClamWin installation path.

Verify the ClamScan executable path and ClamScan database path are correct.

Click Save.

ASSP (Anti-Spam SMTP Proxy Server)

This is installation is option.

ASSP is an open source, multi-platform anti-spam proxy server which will detect and block spam e-mails before they rech your mail server.

The accuracy of ASSP in catching spams is very high, which I do recommend that you give it a try.

Download the latest ASSP installer from

Read the ASSP installation guide available from the ASSP web site.

Try Out Your Installation

It’s time to try out your hMailServer SMTP, POP3 and IMAP installation using Outlook, Mozilla Thunderbird or Squirrelmail.


  1. Hello !
    Thank you for the very good installation guide.
    I have installed according to the guide. I get no errors in the log when i start appache, but i do not get squirrelmail to work. I have put the squirrelmail files in the default directory and i am using a non standard port 3000 in apache because i get an error message on port 80. i have some other stuf running on this computer so that can be the problems. Now to the error.
    I start with http://localhost:3000 , then the index.php loads but just shows the file as a texfile, so the only thing i see is the contenc of index.php. Surely i have done something terribly wrong but i can not found it. DO you have any clues for me.
    Best regards

  2. I have installed it and is working fine with the local host. But i am not able to access the server with the ip address or from any other system present in the LAN. Could you please help me with this??

Leave a Reply

Your email address will not be published. Required fields are marked *