Can I set up a MX record to point to a CNAME record?
In setting up MX records for a mail server, can I point an MX record at a CNAME aliased domain? How do I set up a correct MX record?
1 Reply
According to RFC 2181 you cannot point an MX record at a domain with a CNAME alias:
The domain name used as the value of a NS resource record, or part of the value of a MX resource record must not be an alias. Not only is the specification clear on this point, but using an alias in either of these positions neither works as well as might be hoped, nor well fulfills the ambition that may have led to this approach. This domain name must have as its value one or more address records. Currently those will be A records, however in the future other record types giving addressing information may be acceptable. It can also have other RRs, but never a CNAME RR.
In order to create a proper MX record, you must point it at a domain with a valid A record. For example, if you wanted to handle mail for mycoolsite.tld
and with a mail server is located and listening at mail.mycoolsite.tld
, you will need an A record for mail.mycoolsite.tld
and a corresponding MX record:
mycoolsite.tld A 111.111.111.111
mail.mycoolsite.tld A 111.111.111.111
mycoolsite.tld MX mail.mycoolsite.tld
Pointing an MX record at a CNAME record is invalid:
# not a valid record and will cause problems
mycoolsite.tld A 111.111.111.111
mail.mycoolsite.tld CNAME mycoolsite.tld
mycoolsite.tld MX mail.mycoolsite.tld