Skip to content

How To Setup Your Own Pop3/IMAP Email Server for Local Development Testing

Updated: at 11:18 PM

For the past few months, I’ve been working on building an HTML5 email web client.  It’s fundamentally server based for gathering email.  That means, when I test, I need to connect my server software to both POP3 and IMAP servers.  I’ve been abusing public email services (names not mentioned) and it has made life a little difficult.  That is also not to mention that I often program away from my office which means I pay hotspot charges that can really mount up quickly.

So, I spent a couple hours this morning setting up a local POP3/IMAP mail server on my windows 7 (OK, actually Windows 8 Preview but the process is the same).

 

Install HMailServer

Download and install the latest from http://www.hmailserver.com/index.php?page=download (I used V5.4)

Add an entry in your c:\windows\system32\drivers\etc\hosts for your local mail server (127.0.0.1  mail.local)

In hMailServer admin, add a domain called mail.local and make sure it is enabled

image

Add some test accounts to hMailServer

image

In settings, make sure to enable SMTP,POP3 and IMAP

image

On Advanced, put in your default domain

image

In advanced smtp make sure to bind to 127.0.0.1

image

In Advanced / IP Ranges Put in just your localhost range

image

Disable auto-ban in Advanced

image

 

Install Mozilla Thunderbird Email Client

You need a local client to test with. You can use outlook, or in my case, I used Mozilla’s Thunderbird Email Client.  You can download it from http://www.mozilla.org/en-US/thunderbird/.

Simply install and go into account setup and put in your test email (in my case, test2@mail.local, server mail.local)

image

By default, it puts .mail.local into the domain names.  Simply get rid of the leading period for both smtp and pop3 as follows. Push re-test and you will show successful.

image

You can now send and receive mail locally in your mozilla thunderbird email client (or any other email client you install locally)

 

That’s it!  You’ve setup your own mail server that only listens on your localhost port.  You may need to disable your firewall for local connections.  I’m not sure if that is necessary.