Setup Local Mail Server


While testing e-mail notifications in SOA it is very handy to have a local mail server for testing.
It is very easy to install a local mail server. Lets see how to do it.
Download the latest production release HMail server from here.

We need to install and configure the local mail server in 5 steps.
STEP 1 : Install  the mail server.
STEP 2 : Add the entries in the host file.
STEP 3 : Add exception to the windows firewall.
STEP 4 : Configure the local mail server domain.
STEP 5 : Configure Thunderbird for the local server.


STEP 1 : Install the mail server.

1) Start the installation. Click next on the welcome screen.
2) Accept the agreement and click next.
3) Select a destination folder and click next.


4) Select full installation and click next.

Image 004


5) Select use built-in database and click next.

Image 005



6) Review the Start menu folder and click next.
7) Review the install folder and click install
 

8) Enter a password. For example, welcome1 and Click next.

Image 008


9) Uncheck: Run hMailServer Administrator and click Finish.

Image 009


STEP 2 : Add the entries in the host file.

1) We need to add an entry in the windows hosts file to map our mail server domain to the localhost.
Go to the following location
C:\windows\system32\drivers\etc

Image 010


2) Open the file called hosts in notepad and add the following entries

127.0.0.1 localhost.com
127.0.0.1 mail.localhost.com
127.0.0.1 smtp.mail.localhost.com
127.0.0.1 pop3.mail.localhost.com


STEP 3 : Add exception to the windows firewall.

Now we need to configure Windows firewall to allow the ports required by local mail server.

1) Go to Control Panel and, select Windows firewall.
In the left-hand pane, select Advanced Settings

Image 012


2) Right click inbound rules in the left-hand pane and select new rule.

Image 014


3) Select port as rule type and click next.

Image 015


4) Select TCP.
Select specific local ports and add the following ports 25,110, 143.
Click next.

Image 016


5) Select Allow the connection and click next.

Image 017 


6) Select all three(Domain, Private, Public) and click next.

Image 018


7) Give a name for the rule. For example, Local Mail Server and click Finish.

Image 019


STEP 4 : Configure the local mail server domain.

Now we will configure a domain for the local mail server.
1) Go to the hMail server folder in the installed programs.
Select hMailServer administrator.

Image 021

2) Click connect.

Image 022


3) Enter password as welcome1

Image 023


4) Click add domain.
Image 024



5) Enter the domain name as mail.localhost.com
Click Save.

Image 026


6) Go to accounts in the newly created domain and click Add.

Image 027


7) Enter the following:
Address : admin
Password : welcome1
Administration level : server
Click Save.

Similarly create the following two accounts:
bpel@mail.localhost.com
notify@mail.localhost.com

Image 028


8) Go to settings -> protocols -> SMTP –> Delivery of e-mail
Enter local hostname : mail.localhost.com and click Save.

Image 029


9) Go to settings -> advanced -> Auto-ban
Uncheck the 'Enabled' checkbox and click Save.

Image 001


10) Go to settings -> advanced -> TCP/IP ports -> select SMTP
Enter TCP/IP address as 127.0.0.1
Click Save.
Do the same for POP3 and IMAP.

Image 030


11) Restart the server after changing details for IMAP.

Image 013


12) Testing the local mail server.
Go to Utilities –> MX-query
Enter e-mail address admin@mail.localhost.com and click Resolve.
The IP address should resolve to 127.0.0.1

Image 014


13) Go to Utilities –> Diagnostics
Select Domain as mail.localhost.com
Click Start
All tests should pass except two tests related to MX records, you can ignore those two failing tests.

image

 

STEP 5 : Configuring Thunderbird to work with the local mail sever.

Install Thunderbird from here.

1) Open Thunderbird. Go to Tools –> Account Settings

Image 005



2) Select Add Mail Account.

Image 006


3) Enter the following:
Your name : Admin
Email address : admin@mail.localhost.com
Password : welcome1
Click Continue.

Image 007


4) Thunderbird will auto detect all the required details.
Select POP3
Click Done.

Image 008


5) If you get a warning like this, you can ignore it.

Image 009



6) Send a test mail to see if everything is setup correctly.
From: admin@mail.localhost.com
To: admin@mail.localhost.com

Post a Comment