0

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?

Nick Li
  • 103
  • 2
  • 2
    If it is confusing why this is the case, consider that to *receive* mail you need to allow connections from anywhere on the Internet, with no authentication, so you may want to run that service on a more secure environment, protected from abuse, spam, malware scan, etc... before delivering to a mailbox. Now consider that to allow people to read their mail, you can have a more restricted environment. By the way, in terms of "autodiscovery" you may be interested in `SRV` records as discussed here: https://serverfault.com/a/814718/114782 – chutz Aug 23 '22 at 05:58

1 Answers1

4

When you deal with clients you set the hostname/IP of IMAP/POP/SMTP servers. And the client uses DNS (in case of hostname) to look up the IP address using the A (or AAAA) record of the server(s) you set. MX records are looked up only when a host wants to send mail to a specific domain.

chutz
  • 7,569
  • 1
  • 28
  • 57
Romeo Ninov
  • 3,195
  • 2
  • 13
  • 16