The more I read the more confused I get, so please advise...

I bought a godaddy domain.

I have 2 servers, and I want the following...

  • Justhost (Email)
  • Digital Ocean (Web server for app)

How can I receive emails on Justhost, but run the app on Digital Ocean?

  • Domain should point to which host's nameservers?
  • Where do I setup the A record and where do I point it?
  • Where do I setup the MX record and where do I point it?

3 Answers 3


DNS, email and web pages are all different services and can all three be hosted on the same or different service providers. If you are confused, you could think them through an analogy:

  • DNS is like a phone book having information on all the people with their contact information.
  • IP addresses on A records are like phone numbers. You could e.g. have one for your landline, one for your gsm, one for work etc.
  • Email service is like a fax. You can tell you have a email service through MX records, but eventually it's handled by servers with IP addresses. Likewise, a fax machine has a phone number: there's just a mention on the phone book telling it's not a normal number someone would answer.
    • If you point your example.com MX to a different domain mail.example.net it's like telling you don't have an own fax number, but faxes to you could be send to a fax machine at your workplace.

Now, neither the phone company handling your gsm nor your fax line doesn't have to maintain a phone directory having your numbers, although they both could. Also, anyone already knowing your number can contact you; the service exists to publish this information. The same applies to DNS.


You need to set A and MX DNS record types trough your account on GoDaddy, and everything that is related with your domain name is done there:

  • A record maps hostname with IP address (this is for your web server for app, so here you will set pointing to IP address on Digital Ocean)
  • MX record maps domain name to one or more message transfer agents (this is for your e-mail server, so you will set MX pointing to IP address of your server on Justhost)
    List of DNS record types with brief description on wikipedia.

    GoDaddy help page
  • I am confused. If I point the A record to Digital Ocean, how will Justhost know about it for the MX record i.e. their SMTP is mail.domain.com?
    – Ivan
    May 1, 2020 at 22:16
  • It does not need to know. Others need to know where to find mail server for your domain, i.e. if I want to find you I need to know your address , you don't. That is MX record, IP address of email server on Justhost. But still, after you configure records (MX, A, CNAME...) they will be broadcasted and after some time (it can take hours, but usually less than half an hour) everyone will be able to get IP addresses for your domain, including Justhost.
    – dexter
    May 1, 2020 at 22:36
  • @dexter: DNS records are not broadcasted. They are queried and cached. May 2, 2020 at 8:43
  • @EsaJokinen: you are right. Trying to make simple as possible I made a mistake giving wrong information. Phone book is better analogy.
    – dexter
    May 2, 2020 at 9:51
  1. Name servers should point to whoever is hosting your DNS.
  2. You need to add an A record pointing to your webhost, for example example.com A
  3. You probably also want www.example.com to work, so you can add a CNAME for that as well, pointing at example.com: www.example.com CNAME example.com
  4. You'll need to add MX records pointing to your email service, for example: MX 5 mx1.example.com Your email provider usually tells you what records to add.

All these records need to be added to wherever you're hosting your DNS service.

  • I am confused. If I point the A record to Digital Ocean, how will Justhost know about it for the MX record i.e. their SMTP is mail.domain.com?
    – Ivan
    May 1, 2020 at 22:16
  • 2
    The MX name record should ideally be the domain name of justhost's mail server. If you don't want to do this for some reason, set up a CNAME from mail.example.com to this record and specify an MX record of mail.example.com
    – davidgo
    May 1, 2020 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.