7

I have a situation I'm trying to work through that I'm not entirely sure how to solve.

Here's the situation:

I have a domain, let's say sub.otherdomain.com, that I want to set up e-mail addresses on, and additionally set up an A record on. I don't own this domain, but the owners of the domain have set up a CNAME record to point to one of my domains (let's say customer.mydomain.com)

My understanding is that setting up a CNAME record will cause all record lookups for sub.otherdomain.com to use the records defined on customer.mydomain.com. This seems to work fine for the A record I have set up, but the MX records don't seem to be passing through the CNAME correctly.

In summary, the following records exist:

sub.otherdomain.com

CNAME  customer.mydomain.com

customer.mydomain.com

A xxx.xxx.xxx.xxx
MX (mx details)

My assumption is that e-mails sent to xxx@sub.otherdomain.com would use the MX records from customer.mydomain.com. Is this not the case?

Ryan Brunner
  • 193
  • 1
  • 6
  • 1
    I think your initial assumption is correct - the mail server should follow the CNAME pointer and retrieve the records for customer.mydomain.com. What happens when you dig -t MX sub.otherdomain.com? – Alex Forbes Feb 08 '13 at 17:28

2 Answers2

6

Yes, this should work. From RFC 5321:

Only resolvable, fully-qualified domain names (FQDNs) are permitted when domain names are used in SMTP. In other words, names that can be resolved to MX RRs or address (i.e., A or AAAA) RRs (as discussed in Section 5) are permitted, as are CNAME RRs whose targets can be resolved, in turn, to MX or address RRs.

and:

The lookup first attempts to locate an MX record associated with the name. If a CNAME record is found, the resulting name is processed as if it were the initial name.

mgorven
  • 30,036
  • 7
  • 76
  • 121
5

Check out http://www.ietf.org/rfc/rfc1123.txt

The domain names that a Sender-SMTP sends in MAIL and RCPT commands MUST have been "canonicalized," i.e., they must be fully-qualified principal names or domain literals, not nicknames or domain abbreviations. A canonicalized name either identifies a host directly or is an MX name; it cannot be a CNAME.

cduffin
  • 824
  • 7
  • 8
  • 1
    So, if I'm understanding this correctly, it's impossible to set up MX records on a domain that has CNAMEs defined on it, even if the MX records are defined "further down the chain"? – Ryan Brunner Feb 08 '13 at 16:03
  • 3
    RFC 5321 disagrees with this. RFC 1123 references RFC 821 for SMTP, which is long obsolete. – mgorven Feb 08 '13 at 19:04