Setting up your own email server with hMailServer

Categories:

Configuring your DNS records

Before we install your mail server it is a good idea to ensure you DNS records are correctly setup for email. DNS is vital to the operation of the Internet, and in a nutshell what it does is create a link between a human friendly domain name (e.g. example.com) and an IP addresses. When a user enters a web address into their browser, that domain is then resolved to an IP address which is then used to communicate. When hosting your own email server there are three very important types of DNS records to consider, and these are A, PTR and MX records.

An A record, or Address record is one of the most common types of DNS records you'll come across. Its purpose is to simply create a link between an IP address and a domain name. For example for the domain name of example.com you would have an A record that contained the IP address of the server that was hosting example.com. With A records the domain must be unique, but the IP address does not. This means you can have as many domain names pointing to the same IP address as you want, and is used extensively these days for both Email and Web hosting. In regards to your Email environment, it is best to create a separate A record that identifies your email server. This can be something like mail.example.com or similar. You'll need to create an A record for each server you plan on using as a mail server.

A PTR, or Pointer Record is unique in DNS in that you can only have one PTR address per IP address. This is because the function of a PTR record is to resolve a human friendly name from an IP address, instead of the other way around. Because you are resolving a domain name from an IP address, there can only be one authoritative record. 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.g. mail.example.com), and you may need to contact your hosting company to do this for you.

Finally we have the MX, or Mail eXchange record which is used by other mail servers to direct email to the right place. Unlike an A or PTR record an MX record is not associated with an IP address in anyway, but instead contains the human friendly name of the A record you wish to use for your mail server. This might sound a little redundant as all it is doing is pointing from one record to another, but MX records also have one other important function. 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, the more important that server is) to define in what order other email servers should contact your email servers. If the email server with the highest preference (lowest number in preference field) is not contactable, then incoming email servers will simply use the server identified by the MX record with the next highest preference.

Comments

Anonymous's picture

please i need help

i am using the hmail server with microsoft outlook. i tried the diagnotics test inorder to form an ad-hoc network, to see if i can send mails to other systems, but the outbound test, Mx records test, local connect test gave an error. please what can be done?

Anonymous's picture

Can I use the hMailserver as personal IMAP Server as well

My domain and emails are hosted by GoDaddy, and we have a Win2003 server in the office, which is switched off every evening. can I use hMailserver to download our emails every few hours from GoDaddy and offer to the users in the company as IMAP server.

Surya, New Delhi

Brashquido's picture

Yes, with some work

You can configure user accounts in hMailServer to fetch email from external accounts, however not using IMAP. This means if any users access their GoDaddy accounts from outside the office then you'll have a great deal of trouble keeping your user accounts in sync. If your office server gets turned off each night then personally I do not think it would be worth it because of the administrative overhead.
----------------
Dominic Ryan
6 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

configuring Outlook with HMail

Hi Dominic,

I have recently installed Hmail on my windows 2003 server. Followed the steps suggested on this site.

I have a static IP connection. I have got a domain registered and have done the A and MX setup done. (the www.dnswatch.info points mail.myserver.com to my static IP). So I guess it is setup fine.

My Server is sitting behind a Linksys router. I have forwarded to port 110 and 25 to the correct internal IP on which the HMail has been installed.

I am lost at how to configure my MS Outlook. the configs I tried are:

Incoming : mail.myserver.com / pop.myserver.com
Outgoing : mail.myserver.com / smtp.myserver.com

I am not able to send or receive mails. any help appreciated.

Thanks
Jeetu

Brashquido's picture

Test connections

If you have an A record of mail.myserver.com pointing to your static IP, and an MX record pointing to your A record, then your DNS should be fine (assuming it all resolves correctly externally).

From what you've stated you should be using mail.myserver.com for both your POP and SMTP services. If Outlook isn't working with this then we'll need to take steps to determine where things are going wrong, with the first step being to test the connections.

From a command prompt type the following;

telnet mail.myserver.com 25

This should establish a connection to your SMTP server on port 25. If you get any sort of message indicating that a connection could not be established, then replace mail.myserver.com with the internal IP address of your HmailServer. If you are unable to establish a connection using mail.myserver.com then it will be a DNS or router issue, if you are unable to establish a connection via internal IP, then it will be your server or a LAN based network issue.

----------------
Dominic Ryan
6 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Configuring Outlook - Jeetu

Hi Dominic,

Thanks for the response. I did that and am getting :
220 mail.myserver.com ESMTP. So I guess this is working fine.

However, I have progressed from there. Now I have been able to configure my outlook with an account that talks to the SMTP and POP that I setup for the HMailServer. However, I have an unusual issue. When I try sending mail from an account (say ) to another mail (say ), I am sometimes able to do this successfully and some times I get the mail bouncing back on me with an error : Recipient Not Reachable. When I try the other way around, sometimes the mail reaches and sometimes : Domain Not Found.

The tricky issue is, this is not happening all the time...sometimes it goes through and others it does not. Infact, when I tried sending mail from this account to 2 different accounts, sometimes it reaches one and bounces the other. Any help?

Thanks
Jeetu

Anonymous's picture

Outlook Configuration

Hi Dominic,

Thanks for the response. I did that and am getting :
220 mail.myserver.com ESMTP. So I guess this is working fine.

However, I have progressed from there. Now I have been able to configure my outlook with an account that talks to the SMTP and POP that I setup for the HMailServer. However, I have an unusual issue. When I try sending mail from an account (say ) to another mail (say ), I am sometimes able to do this successfully and some times I get the mail bouncing back on me with an error : Recipient Not Reachable. When I try the other way around, sometimes the mail reaches and sometimes : Domain Not Found.

The tricky issue is, this is not happening all the time...sometimes it goes through and others it does not. Infact, when I tried sending mail from this account to 2 different accounts, sometimes it reaches one and bounces the other. Any help?

Thanks
Jeetu

Anonymous's picture

hmail server does not send mail

this is what i get from the log file. please email any feedback to

DEBUG" 872 "2011-01-03 19:01:26.311" "Closing TCP/IP socket"
"DEBUG" 872 "2011-01-03 19:01:26.311" "Ending session 25"
"DEBUG" 1836 "2011-01-03 19:01:26.311" "Delivering message..."
"APPLICATION" 1836 "2011-01-03 19:01:26.311" "SMTPDeliverer - Message 179: Delivering message from to . File: C:\Program Files (x86)\hMailServer\Data\{18BB9276-E25A-4D9B-87DB-233CCE5A0907}.eml"
"DEBUG" 1836 "2011-01-03 19:01:26.311" "Applying rules"
"DEBUG" 1836 "2011-01-03 19:01:26.311" "Performing local delivery"
"DEBUG" 1836 "2011-01-03 19:01:26.311" "Local delivery completed"
"DEBUG" 1836 "2011-01-03 19:01:26.327" "Performing external delivery"
"APPLICATION" 1836 "2011-01-03 19:01:26.327" "SMTPDeliverer - Message 179: Relaying to host bookshare."
"DEBUG" 1836 "2011-01-03 19:01:26.327" "SD::_InitiateExternalConnection"
"DEBUG" 1836 "2011-01-03 19:01:26.327" "Creating session 26"
"TCPIP" 1836 "2011-01-03 19:01:26.327" "Connecting to bookshare..."
"APPLICATION" 4368 "2011-01-03 19:01:28.327" "SMTPDeliverer - Message 179 - Connection failed: Host name: bookshare, message: No connection could be made because the target machine actively refused it"
"DEBUG" 1836 "2011-01-03 19:01:28.327" "SD::~_InitiateExternalConnection-5"
"DEBUG" 1836 "2011-01-03 19:01:28.327" "Ending session 26"
"DEBUG" 1836 "2011-01-03 19:01:28.327" "SD::~_DeliverToExternalAccounts-2"
"DEBUG" 1836 "2011-01-03 19:01:28.327" "Collect delivery result"
"DEBUG" 1836 "2011-01-03 19:01:28.327" "Collect delivery result - Done"
"DEBUG" 1836 "2011-01-03 19:01:28.327" "SD::_RescheduleDelivery"
"APPLICATION" 1836 "2011-01-03 19:01:28.327" "SMTPDeliverer - Message 179: Message could not be delivered. Scheduling it for later delivery."
"DEBUG" 1836 "2011-01-03 19:01:28.327" "PersistentMessage::SetNextTryTime()"

Anonymous's picture

hmail

You have a great article on hmail. But I can not tell what is in the screencaptures. Anyway I can down load them so I can enlarge them.

Anonymous's picture

Newby question

Hi D

If I have 50 email users, is there a limitation with Win7 or Win XP on how many concurrent users can log in at same time.
Do I need to get a version of MS server software for multiple users logging in to get mail at the same time?

Sorry for th silly question.

Bruce
South Africa