Why do we need MX record, can't we directly use A Record?

This question might look basic, but I was wondering that let's say for email routing there’s a use of MX record which points to FQDN of Mail server and that points to A record. What is reason to have MX record when eventually, we are resolving FQDN and getting A record for information, I mean why can't instead of fetching MX record of Domain, it fetches A record of the domain and sent an email.

Thanks for Help in advance :)


There's nothing stopping you from relying soley on 'A' records for email delivery.
Suppose you have example.net with no published 'MX' record, but you have an 'A' record for server.example.net. If someones sends an email to [email protected], as long as server1 has a configured SMTP server, and user1 exists, the email should be delivered. MX records however, enable you to distribute load across several servers and have a fallback option.

In fact, I think the use of SMTP actually predates the use of DNS. RFC 821 which describes SMTP, was published in 1982. RFC 883 which describes DNS was not published until a year later, in November of 1983 and was not implemented until 1984. Until then the standard mechanism for name resolution was HOSTS.TXT which has no facility to distinguish resource record types, and was only a table of ip address to hostname mappings, it is what we know today as /etc/hosts for more information see https://en.wikipedia.org/wiki/MX_record


The fundamental reason is that you may want to use the same domain name in different ways for different services. Ie, the domain part of an email address may also be used for something else than just incoming email.

Eg with [email protected], you may want to have address records (A/AAAA) for example.com that are used for something else than the SMTP server. Maybe a web server, maybe something else, it doesn't really matter what exactly.
That said, if no MX is present, then the standard is to fall back to looking up address records and using those also for email delivery.

Sidenote, if this was all designed today, MX would actually be redundant as SRV was later introduced as essentially a generic form of MX that can work for any service.
With SRV you specify which service type should be mapped to which host, rather than having a dedicated record type for one particular type of service like with MX.
Additionally, http client such as web browsers would presumably also use SRV instead of just looking up address records if SRV had just been around earlier, which would actually be quite nice. But that is not what we have, and so far no change is happening in that regard.


Because that is the standard. Period. You can do whatever you want - but millions of other players have agreed on that being the standard and use that. At the end that is what it boils down to - not everything in DNS makes sense these days, but the standard has grown over time.

Also note that the MX entry has additional info that an IN A record does not have - so there is a functional difference if you have multiple email servers and want to give a priority. Multiple IN A records do not allow prioritization.

But ultimately, the "why" answer is "because that is the standard as it was decided a long time ago".