I've got a requirement to provide subdomain-specific MX records while serving HTTP traffic at customer.oldandbusted.com, something like this:

customer1.oldandbusted.com.  IN  A
customer1.oldandbusted.com.  IN  MX  10 mail.customer1.com

customer2.oldandbusted.com.  IN  A
customer2.oldandbusted.com.  IN  MX  10 mail.customer2.com

Let's say I want to roll out another zone, something like this:

customer1.newhotness.com CNAME customer1.oldandbusted.com
customer2.newhotness.com CNAME customer2.oldandbusted.com

It is my understanding RFC1034 specifies that when encountering a CNAME the DNS software should use the provided value for all record types, A, MX, TXT, etc.

My question is does email addressed to address@customer1.newhotness.com really get delivered to mail.customer1.com? Does anyone have experience doing this? Does it really work? Do MTAs correctly interpret the CNAME and resolve the MX recoed, or is this just crazytalk that could be hit-or-miss?


  • Yes from a DNS point of view the CNAME approach for MX is fine, however I am quite sure in the past there had been MTAs having problems with that, I can't recall the details. It is related with normalizing the host names (for spam prevention) – eckes Apr 23 '17 at 15:32
  • Yeah, this is my concern. We've got enough mail coming through that even a small percentage of failed deliveries would be a major problem for our customers. – Hawk Apr 24 '17 at 17:21
  • I can only find the usual warning to not mix MX with CNAME, but that wont be your setup. So maybe I remember wrong and pure CNAME are fine. On the other hand, why not put the A and MX entries under both zones. It also speeds up the lookups, why risk problems. Inany case the value of the MX record should be the name of an A record (not a CNAME). email-museum.com/2008/09/08/why-you-shouldnt-mix-cname-and-mx – eckes Apr 24 '17 at 23:27

The MTA asks a DNS resolver of some sort to turn a name into an IP address. The DNS resolver does so. The MTA never even knows that at some point during the turning-into-an-ip process, the DNS resolver saw a record of type CNAME. So yes, it works just fine.

However, adding a CNAME record in DNS will not magically reconfigure your mail server. You have to go and tell it that it's supposed to handle mail to the domain customer1.newhotness.com as well as mail to the domain customer1.oldandbusted.com. Otherwise other MTAs will find yours just fine, but when they try to deliver to it, yours will go "What is this garbage, you foul spammer" and refuse to take it.

  • Right. I don't suppose you have an example of this actually working somewhere? – Hawk Apr 24 '17 at 17:24
  • The configuration of your MTA to accept both domains (and alias the mailboxes in one domain to the others) depend on the MTA software and are unrelated to the DNS layout. Simple solution would be to add both domains to "localdomains", in that case user@anyofboth.domains will be accepted into the user inbox. – eckes Apr 24 '17 at 23:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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