Sunday, October 1, 2017

Create Email Server on Winows WAMP

Do you know you can create an email server on windows platform? Today I am going to show you how to setup an email server on windows using WAMP and integrate a webmail interface with it. It may help in testing debugging your scripts dealing with mail functions.

Create Email Server on Winows WAMP

You will need following for this setup:
First of all enter two host enteries in V-Hosts file of WAMP. First one for main domain and second one for webmail interface. The file can be found at the following location on windows.
C:\wamp\bin\apache\Apache2.2.11\conf\extra\
<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName testdomain.com
    ServerAlias www.testdomain.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/roundcube"
    ServerName mail.testdomain.com
    ServerAlias www.mail.testdomain.com
</VirtualHost>
You will have to add an entry to windows hosts file for above virtual hosts. The windows hosts file can be found on the following location on windows.
c:\windows\system32\drivers\etc\
I am sure you know how to install WAMP and get it running. I am going to show you the rest two steps hMailServer and Roundcube webmail interface. After you have downloaded both follow these steps to install hMailServer.

Install & Configure hMailServer:

  1. Run the setup of hMailServer you downloaded.  
  2. Click "Next".
  3. Check "I accept the agreement" and click "Next".
  4. Set the destination folder where you want to install hMailServer and click "Next".
  5. Select components you want to install check both and click "Next".
  6. Check "User built-in database engine" and click "Next".
  7. Click "Next".
  8. Set the password you will need this password to connect to server. Click "Next".
  9.  After all above steps click "Install" to continue installing hMailServer.
Now after installation, launch hMailServer and connect. It will ask for the password you entered during installation enter the password and connect.

1. On welcome screen click on domains on left side navigation panel and then click on "Add" on top right buttons.

Create Email Server on Winows WAMP-01

2. Enter a domain name in our case for this tutorial I am using "testdomain.com". Click Save.

Create Email Server on Winows WAMP-02

3. Click on Accounts on left side navigation panel and then click on "Add" on top right buttons.

Create Email Server on Winows WAMP-03

4. Enter email address and password for the account and then click "Save".

Create Email Server on Winows WAMP-04

Configure Roundcube:

1. Extract the roundcube files you have downloaded to "www" directory in WAMP and rename it to "roundcube".
2. Open a browser and enter the url "localhost/roundcube/installer"
3. On the first screen you will see the status of environment normally its all good at this step you just have to click "Next".

Create Email Server on Winows WAMP-05

 4. On next page you don't have to change all just enter database host, database name, username for database and password in  "Database Setup" section. Also enter the host for SMTP server in "SMTP Settings" section. Click "Create Config".

Create Email Server on Winows WAMP-06

5. This is final step you will see the "Test Config" page. Click on "Initialize Database" and all done.
Now open "mail.testdomain.com" in any browser and you will see the following page.

Create Email Server on Winows WAMP-07

Enter the email address and password you configured in hMailServer and login. It will let you in your inbox and you will see the following page.

Create Email Server on Winows WAMP-08

Presto! You just created an email server and webmail interface on local windows platform.
NOTE: If you are still having issues make sure you followed all the steps carefully if it still doesn't work you may need to add an exception for hMailServer in firewall or change the "Require SMPT Authentication in hMailServer Administrator Panel ➞ Settings ➞ Advanced ➞ IP Ranges ➞ My Computer "