With my limited understanding, I understand when an SMTP server sending email out, it resolves the MX record to get to the destination email server.
But what about when you setup an email account on an email client? When you provide the "host" (e.g. mail.mydomain.com) for IMAP servers, does the email client connect to the IMAP server IP by resolving the A record for the domain provided, or by the MX record? (and in fact, what about when email client connecting to SMTP server, not SMTP server sending outbound email?)
It makes more sense to me that it will be resolved through MX record as well, as it is already pointing to the mail server, but if that's the case we won't need autodiscover service, and in fact, wouldn't make sense why a lot of the time we uses "mail.mydomain.com" instead of just "mydomain.com" as the host.
I could not find any detail on this as the search results are masked by all the posts explaining how Mx records work when SMTP server delivering email. Can someone explain or point me to the right resources?