2

I have a heroku app on a subdomain like x.herokuapp.com which is mapped to my domain name via a CNAME record. I want emails to be handled by zohomail so I've tried setting up MX records but these seem to fail.

Am I correct that even emails are mapped through the CNAME instead of the MX record?

www.x.com   CNAME   x.herokuapp.com
x.com       CNAME   x.herokuapp.com
x.com       MX      mx.zohomail.com
x.com       MX      mx2.zohomail.com

What can I do to handle email through zohomail's MX records and still keep my domain name mapped to herokuapp because that's where the app is running?

Thanks for helping out!

solsol
  • 1,121
  • 8
  • 21
  • 31
  • 1
    Related: [Why does Heroku warn against “naked” domain names?](http://serverfault.com/q/408017/126632) – Michael Hampton Dec 13 '14 at 17:38
  • Is your DNS service actually *allowing* you to have a CNAME at the apex of your domain, or did you make a mistake while redacting this? – Andrew B Dec 14 '14 at 00:42

1 Answers1

2

A CNAME record defines that one name is an alias of another name (the canonical name).

The implication of having an entire name be an alias is that it cannot also have records of its own, meaning you cannot have those MX records.
This is also why you cannot have a CNAME record at the zone apex (where you will always need at least SOA and NS records).


You may have to contact the service provider for a solution that does not involve the use of CNAME records.

One possibility that you could set up on your own would be to use a DNS service with an alias functionality that can add the specific record types that you need (A/AAAA records?) to your zone and keep those up to date based on a provided name. See services like Route53, DNSimple, DnsMadeEasy and probably many others that provide that kind of functionality.

Another possibility would be to have A/AAAA records that points to a web server that can do an HTTP redirect to a URL that does not involve this particular name (ie example.com -> www.example.com).

Håkan Lindqvist
  • 33,741
  • 5
  • 65
  • 90