I have a Heroku app and a domain that maps to it. The host records are set up as follows: Domain setup

Now I want email to admin@mydomain.com to be forwarded to my gmail account. I was told by the support for my domain name registrar that since I'm using CNAME records that's not possible as the MX records will be overridden by the CNAME records. Is that true? If so how can I work around it?


The naked domain cname problem is common. The dns specs do not allow you to redirect a naked domain. Because of this, many dns providers do not allow you to use a cname for @. Your dns providers way of making @ records use a CNAME must be interfering with other records.

Your workaround is as follows:

Google runs servers that do nothing but redirect naked domains to other domains (ie yourdomain.com to www.yourdomain.com) In your Google Apps control panel, go to Domain Settings -> Domain Name, and follow the instructions to redirect your naked domain to www.yourdomain.com. In your dns settings, have them keep your www record, but change the @ CNAME record to an A record: give them the ip addresses provided to you by Google in their instructions. Have them add Google's MX records and you're set.

  • Is it possible to do this without Google Apps? I only have gmail. – Johnny Jan 3 '13 at 12:17
  • 1
    I don't think Google allows you to make emails to custom domains go to Google's MX servers and be sent to a @gmail.com address. If you don't want to get a google apps account because they recently stated charging money, you can get something similar through microsoft: domains.live.com – Edwin Jan 3 '13 at 18:02

As long as you have a CNAME for the base domain, you can't have an MX record for the same name.

There are two things you can do. You can either have a mail server on the server that the CNAME points to, and have that mailserver forward all mails to wherever it is you want it. This has the advantage that you can set up many different forwardings if you like.

The other option is to have record type A instead of a CNAME for the domain. Then you can add as many MX records as you like.

(Original, erroneous answer - please ignore! They're wrong. The CNAME record will be used only if the list of MX records is empty. See section 5.1 of RFC 5321.)


RFC5321 says that if a CNAME record is found when looking for an MX record the email routing restarts using the domain indicated by the CNAME

unless you can update the MX for the CNAME destination you'll need to use an A record (or several) instead of CNAME and list the apropriate MX record(s) to get you email to the correct destination.

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.