You are on page 1of 15

Setting up your own email server with hMailServer

There are a many email servers for Windows out there that range in price depending on functionality and the software vendor. However, it is not often you find an email server for Windows that is open source (free to use and modify via the GPL license), feature rich, stable and very well supported. There are some notable free offerings such as MailEnable Standard and Windows 2003 Server even comes with a basic POP3 email server, but it seems that they are always just crippled enough to make you want something a bit more. This is where hMailServer comes in as it offers just about everything you could want in an email server. SMTP with advanced routing abilities, POP3, IMAP4, distribution lists, powerful anti-spam tools, real time anti virus protection, PHP/COM based web administration, log file analysis, configurable server messages and rules, advanced performance options. The list goes on, and all this in a RFC compliant package with an easy to use GUI interface. In this guide we'll cover the basics of what you need to do to configure your email environment properly using hMailServer 4.3.1 as your email server. This includes;

Configuring you DNS records o A (Address) record o PTR (Pointer Record) record o MX (Mail eXchange) record o Considerations for hosting from home Installing hMailServer o Select installation path o Select installation type o Select built-in or external database o Select program group for start menu access Configure hMailServer o Create domain o Create postmaster account o Create abuse alias for postmaster account o Set SMTP host name o Configure RFC compliance o Configure SMTP relay options to prevent open relay Test your email environment o Test against dnsreport o Test for open relay

Configuring your DNS records

but MX records also have one other important function. Because you are resolving a domain name from an IP address. This is because the function of a PTR record is to resolve a human friendly name from an IP address. This means you can have as many domain names pointing to the same IP address as you want. If the email server with the highest preference (lowest number in preference field) is not contactable. Considerations for hosting from home Before we go on it is important to note that if you are wanting to host your own email server from home over a standard ADSL or Cable connection.Before we install your mail server it is a good idea to ensure you DNS records are correctly setup for email. When a user enters a web address into their browser. If possible it is best to set your PTR record of the IP your email will be hosted from to be the same as your A record (e.example. mail. the more important that server is) to define in what order other email servers should contact your email servers. When hosting your own email server there are three very important types of DNS records to consider. but the IP address does not. For example for the domain name of example.example. A PTR. and in a nutshell what it does is create a link between a human friendly domain name (e.g. or Pointer Record is unique in DNS in that you can only have one PTR address per IP address.com) and an IP addresses. With A records the domain must be unique. . then there are a few things that may make your environment a little more complex. or Address record is one of the most common types of DNS records you'll come across. These are.com or similar. instead of the other way around. then incoming email servers will simply use the server identified by the MX record with the next highest preference. but instead contains the human friendly name of the A record you wish to use for your mail server.com).com. Unlike an A or PTR record an MX record is not associated with an IP address in anyway. example. An A record. In regards to your Email environment. that domain is then resolved to an IP address which is then used to communicate.com you would have an A record that contained the IP address of the server that was hosting example. there can only be one authoritative record. and is used extensively these days for both Email and Web hosting. DNS is vital to the operation of the Internet. Its purpose is to simply create a link between an IP address and a domain name. PTR and MX records. Finally we have the MX. This is to establish the pecking order of your email servers by using a preference field in which you can enter a numerical value (the lower the number. or Mail eXchange record which is used by other mail servers to direct email to the right place. it is best to create a separate A record that identifies your email server. This can be something like mail. and these are A.g. This might sound a little redundant as all it is doing is pointing from one record to another. and you may need to contact your hosting company to do this for you. You'll need to create an A record for each server you plan on using as a mail server.

then your are bang out of luck. so as long as you do have a PTR you should be ok. To update your mail server A record every time your IP changes you'll need to use a Dynamic DNS service. Among the trickier problems to solve is that a lot of the time ISP's will block commonly attacked ports on home broadband services to try and stop (or slow at least) the spread of viruses and prevent the saturation of their network. With exception to the last few points.• • • • • You'll most likely have a dynamically allocated IP address. You ISP may well have prohibited hosting your own email (or web) server over your home broadband connection in their terms of service or acceptable usage policy. Installing hMailServer That is most of the heavy stuff out of the way. which is all done via a GUI interface meaning I can use screen shots to do the talking and is hopefully easier to follow. Some ISP's will let you remove these blocks if you ask. These services are all over the web. With this cause all outgoing email from your server is sent out through your relay server which should be set up properly and will allow you to send email to servers that don't allow incoming email from dynamic IP addresses. A lot of email servers will check for the existence of a PTR record for an IP before accepting any email from it. If your ISP has specified in the TOS or AUP that it does not allow the hosting of services over your connection. these issues can usually be pretty easily be overcome. meaning that the A record for your mail server will need to be updated everytime your IP address changes. . A lot of email servers block email originating from dynamic IP addresses. From here on in it is all installing and configuring hMail. or via a web interface. especially if you are using a dynamically allocated IP address. My suggestion is to look elsewhere as there are plenty of ISP's that will give you unrestricted use of your connection (as it should be). A lot of ISP's block the standard TCP/IP port numbers used by email servers on home connections. and will require you to install a Dynamic DNS client on your server which updates your DNS records everytime your local IP address changes. If you are hosting your email server on a dynamic IP address then you'll need to look at using an SMTP relay server (sometime called smart relay) which is usually your ISP SMTP server. You'll probably won't be so lucky in regards to the PTR record as ISP's usually have their own and will almost never change these for you. Click any of the images to get a pop-up window displaying a full sized image. You most likely will not be able to set a PTR record for your IP address.

double click on it to initiate the install process as shown below in figure 1.3.After downloading the latest stable hMail server installer package (currently 4. .1) from the hmailserver website. Figure 1 Select the installation path for hMail as shown below in figure 2.

Figure 2 Select a full or custom install of hmail (full recommended) as shown below in figure 3. Figure 3 .

or use an external database. However. If this is a dedicated email server then it is recommended to use the built in database server as shown below in figure 4.Select wether to use the MySQL server built into the hMail distribution. if you already have MySQL installed (or are planning to) or would like to use Microsoft SQL server then select the external database server option. . Figure 4 Set the start menu program group for hMail as shown below in figure 5.

Figure 6 .Figure 5 Confirm your settings as shown below in figure 6.

.Click install and hMailServer will be installed as shown below in figure 7. make sure the "Run hMailServer administrator" option is checked as shown below in figure 8 and click finish. Figure 7 Once installation is complete.

add an account. Start by clicking the Add domain button as shown below in figure 9. create an alias. the next step is configuration. The configuration steps below show you how to add a domain. configure RFC settings and configure SMTP relay options to prevent open relay.Figure 8 Configuring hMailServer With the installtion of hMailServer successfully completed. setting the server host name. Figure 9 .

and as we have set postmaster to be the catch-all we will now set up an account for it. You can also set individual mailbox and message size. but they are not covered in this guide. To be RFC compliant all domains should accept email to a postmaster account.com. If a mail is sent to an address on your domain that does not have a POP account or alias. it is now time to create accounts.Enter the domain name as shown below in figure 10. Place the name of the account in the Account address feild. signature and fetching of email from external accounts. From here you can also set the global maximum mailbox size as well as the maximum message size for your domain. as well as many other options not covered in this guide such as Active Directory intergration. then it is redirected to the catch-all address. . In this example we have set the catch-all address to postmaster@example. and then set the catch-all address. auto-reply. Figure 10 With the domain setup. forwarding. Once the domain is created you are also able to access several other tabs to set global settings. and then enter a password as shown below in figure 11.

In this example we will create an alias of abuse@example.com that points to the postmaster@example. and in this case it can be handy to uses an email alias that points to an existing account.com repsectively) in the To feilds. domains are also required to accept email to the abuse email address to be RFC compliant. Figure 12 .Figure 11 Sometimes it is not practical or desirable to setup an account for every email address you want.com. Simply enter the alias you'd like to use (in this case abuse) in the Redirect from feild and enter the account and domain ( in this case postmaster and example. Like the postmaster address.

select and expand the Settings item and then select the Protocols option. as otherwise you will not be able to send or recieve mail. You may not wish to use the IMAP server. Make sure you have at least the SMTP and POP3 servers ticked. If your ISP requires authentication.com. Using the navigation window in the left. account and alias setup lets look at selecting what email services we want to use. then you will want to enter the name of your ISP's SMTP server in the Relayer field. Figure 13 Next step is to set the server host name. expand the Protocols item and select SMTP. but you will need it if you wish to provide webmail functionality to your users. In this example we'll use mail. In the navigation window on the left. This can be very important as some email servers will not accept email or mark it as spam if the host name does not match the hostname specified in the MX record we set earlier. Note: If you are looking to host your own email server over your home broadband connection.example. then you'll also need to provide those details in the fields below. In the Host Name field enter the full host name you specified in your MX records.Now that we have a domain. .

and without this option set you email server may not be able to recieve emails from them Figure 15 .Figure 14 With the host name set we will now set some extra RFC compliance settings. It is important that your email server be RFC compliant as otherwise it is likely that many domains will mark your email as spam. You can enable this ticking the Allow empty sender address option. and that is if they accept it at all. It is also a good idea to enable the Allow incorrectly formatted line endings option as several popular email server packages out their vary slightly in the way they terminate email messages. From the page you are on. One of the RFC requirements for email servers is that they accpet a null sender address. simply click on the RFC Compliance tabe at the top.

All you have to do here is ensure that the Local to local.net and aupads. Figure 16 Testing the configuration Almost done now.The final step in the basic configuration of your email server is to enure it is not an open relay. There are several tests available for free on the internet for testing your email server for open relay. All these options are shown below in figure 16. An open relay is when a server enables mails to be sent through it to other domains on behalf of domains that do not exist on the local server.org. From here select the IP Ranges option and then select the Internet option. Local to external. . the only thing left to do is test your email environment to make sure everything is configured correctly and ensure it is not an open relay. and External to local options are ticked from under the Allow deliveries from section. and the ones I'd suggest using are the tests at abuse. Luckily hMailServer makes in very easy to prevent this. and it can be near impossible to get off these blacklists once you're on it. Just to be sure though it is always best to check the settings. Finally also ensure that the To remote accounts option is ticked from under the Require authentication for deliveries section.com which will give you a good overview of how well your email system is setup. Being an open relay is a very quick way in which to get yourself blacklisted. If DNSReport finds any issues of concern it will notify you and offer advice on what needs to be fixed. and in fact by default you should not have to change a thing. In the navigation window to the left. select the select and expand the Advanced menu item from under the Settings tree. Once you have passed these tests then you should be all clear to go ahead and start creating other account and finally sending and recieving email from your very own email server. First stop is to plug your domain in at DNSReport.