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!


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).

Your Answer

