0

Let us say I have a domain example.com that points to IP 192.0.2.4, hence in the DNS I would see:

example.com  A  192.0.2.4
www.example.com  CNAME  example.com

Now, most MX records appear to be set in this way into the DNS

example.com  MX 10 mail.example.com
mail.example.com  A  192.0.2.4

Can I just do this?

example.com  MX 10 example.com

By leaving out the: mail.example.com A 10 192.0.2.4

P.S. I looked into RFC "3.3.9. MX RDATA format" but it doesn't seem to say much

Marco Demaio
  • 580
  • 1
  • 8
  • 22

1 Answers1

4

Yes, of course you can create such an MX record. When all your services are running on a single ip-address and/or a single server and the host that will receive mail for @example.com IS example.com.

example.com.      IN  MX 0  example.com. 
example.com.      IN  A     203.0.113.1

There is no requirement to do this:

example.com.      IN  MX 0  mail.example.com. 
example.com.      IN  A     203.0.113.1
mail.example.com. IN  A     203.0.113.1

But in that scenario you can also simply omit creating MX records entirely. When no MX records are found for @example.com SMTP will deliver mail directly to the host example.com .

See RFC 5321 §5.1

... If an empty list of MXs is returned, the address is treated as if it was associated with an implicit MX RR, with a preference of 0, pointing to that host.

HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • 5
    "you can also simply omit creating MX records entirely", I don't recommend this. One of the weights that spam filters use is a check for an MX record. If a sending domain has no MX record, it's considered more likely to be spam. – longneck Aug 02 '18 at 13:30
  • 1
    Maybe, but for receiving mail that is not an requirement – HBruijn Aug 02 '18 at 16:26