If you want to host your website and email on different servers you need to make sure that website and email traffic is routed to the correct server. In this article we look at three common DNS set-ups:

  • Hosting your website and email on the same server
  • Host the website on another server
  • Host email on another server

All the DNS records mentioned in this article are explained on the Common DNS records page page in the knowledgebase.

Host your website and email on the same server

To illustrate the various set-ups we will use the domain example.net and assume that the domain is hosted on our Strawberry server, which has the IP address 84.18.206.207. If we host both the website and email on the server then our DNS records are as follows:

example.net.                 A         84.18.206.207
www                          CNAME     example.net.
webmail                      CNAME     example.net.
example.net.                 MX        example.net. (0)
example.net.                 MX        backup-dmx01.active-ns.com. (100)
example.net                  TXT       v=spf1 mx a include:spf.active-ns.com ~all

Here, everything points to 84.18.206.207, apart from the second (fall-back) mail server. Website traffic for example.net and www.example.net will go to 84.18.206.207, and incoming emails will also be routed to example.net. For the SPF record we are using our global SPF record.

Host your website elsewhere but keep email on our servers

To host the website on a different server without changing how emails are routed we need to make a few changes:

  • The A record should point to the IP address of the external server (for this example we will use the IP 98.76.54.32).
  • We need to update the MX record so that it no longer points to the A record.
example.net.                 A         98.76.54.32
www                          CNAME     example.net.
webmail                      CNAME     example.net.
mail                         A         84.18.206.207
example.net.                 MX        mail.example.net. (0)
example.net.                 MX        backup-dmx01.active-ns.com. (100)
example.net                  TXT       v=spf1 mx a include:spf.active-ns.com ~all

To change were website traffic is routed you can simply update the main A record. To make sure that incoming emails are still delivered to 84.18.206.207 you also need an A record for mail.example.net. And finally, you need to point the primary MX record to the mail subdomain.

It is worth noting that we are still using the global SPF records. Because the records whitelists both the A and MX record there is no need to change it.

Host your email elsewhere but keep the website on our servers

It is of course also possible to host only email elsewhere. In that case you only need update the MX records:

example.net.                 A         84.18.206.207
www                          CNAME     example.net.
example.net.                 MX        aspmx.l.google.com. (1)
example.net.                 MX        alt1.aspmx.l.google.com. (5)
example.net.                 MX        alt2.aspmx.l.google.com. (5)
example.net.                 MX        alt3.aspmx.l.google.com. (10)
example.net.                 MX        alt4.aspmx.l.google.com. (10)
example.net                  TXT       v=spf1 mx a include:_spf.google.com ~all

Apart from replacing the MX records we made two other changes:

  • We removed the CNAME record for the webmail subdomain. You don’t have to do that but the record is effectively redundant now that incoming emails are routed elsewhere (i.e. you probably no longer need to access web mail on the server).
  • We updated the SPF record: it now includes G Suite’s global SPF record.

Host everything elsewhere

There is one other possible scenario: hosting both your website and email elsewhere. There is little point in using a hosting package purely to route website and email traffic to external servers (you probably want to change your domain’s name servers to manage your DNS elsewhere instead) but it is of course possible:

example.net.                 A         98.76.65.43
www                          CNAME     example.net.
example.net.                 MX        aspmx.l.google.com. (1)
example.net.                 MX        alt1.aspmx.l.google.com. (5)
example.net.                 MX        alt2.aspmx.l.google.com. (5)
example.net.                 MX        alt3.aspmx.l.google.com. (10)
example.net.                 MX        alt4.aspmx.l.google.com. (10)
example.net                  TXT       v=spf1 mx a include:_spf.google.com ~all

The above DNS records send website traffic to 98.76.54.32 and email traffic is routed to G Suite.