Setting Up Your Domain and DNS

This page explains how to set up your DNS to ensure that your incoming mail can reach you.

DNS and IPs

With most domain purchases, the registrar usually offers a DNS service in with the package. With this DNS you can usually control the IP which the domain converts to and also create multiple sub-domains (codecrafters.com is the domain name, www.codecrafters.com is a sub-domain, mail.codecrafters.com is another sub-domain). Each of these sub-domains can also usually have its own set of DNS information (IP, MX records) which can be useful for load sharing and backup facilities.

MX Records

This information is stored on the DNS for each domain or sub-domain. It is used to control and direct incoming mail to the correct mail server. To make sure mails for your domain are directed to your computer, you must set the MX records to contain the host address of your mail server. If required, you can set more than one MX record and prioritize them accordingly. For example you could use:

mail.yourdomain.com - priority 5 (primary server)
mail2.yourdomain.com - priority 10 (secondary server)
mail.someotherdomain.com - priority 15 (ternary server)

The lowest priority value is used first and if this doesn't respond then the next lowest value is used. This continues until either one of the hosts has responded or all of them have failed. This system allows you to run backup servers or even share the load with multiple mail servers.