20

After some searching I've come up totally empty handed on if there is any standard (or non-standard for that matter) specification or best practice for specifying the IMAP server for a domain name. I.e. if I have an account such as "jimi@example.com", and I wish to read my mail via IMAP, is there any DNS record which would indicate to my mail client which mail server it should be contacting? I've never seen anything like this, and virtually all email setup instructions I've seen include an exact host name for IMAP, e.g. "mail.example.com" or "imap.example.com". I guess the assumption is that the employees or other users of example.com can find out what server to use from their administrator. However if example.com were to have thousands of accounts, this would become burdensome. It would seem very useful to just enter your email address "jimi@example.com" and have it look up the IMAP server name in DNS based on the email's domain name (not dissimilar to how an MX record works for SMTP).

Anyone heard of anything like this?

  • 4
    Some applications support auto-discovery dns and there is probably some rfc or spec for auto discovery of imap. I would not expect that many have followed it, for the very reasons you mentioned. An org will publish docs or use config management to configure end-points. smtp needs to know names for mail routing. IMAP is human routed. :-) – Aaron Nov 14 '16 at 5:33
35

From a DNS perspective you have SRV DNS records which allow the use of DNS for publishing services and service discovery. Their main use is to allow services to run easily on non-standard ports and to reduce the configuration burden when setting up clients.

A SRV record has the following form:

_Service._Protocol.Name. TTL Class SRV Priority Weight Port Target

and one for IMAP is defined in RFC 6186 and would look like:

_imap._tcp.example.com. 3600 IN SRV 0 10 143 my-imap-host.example.com.

or

_imaps._tcp.example.com. 3600 IN SRV 0 10 995 my-imaps-host.example.com.

Most email clients don't specifically look for an IMAP server first though, but use auto discovery to derive email client settings from the email address a user enters.
If a user enters username@example.com, depending on the client those typically involve either

  • an _autodiscover._tcp.example.com. SRV record such as used by MS Exchange and Outlook
  • an actual host called autoconfig.example.com.
  • or more

A pretty good write up is found here : https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration

| improve this answer | |
  • 1
    Thanks - yes that's exactly the kind of thing I was seeking. It's interesting that the "standard" way of doing it (SRV record) seems to be not popular at all. I guess there is little pressure to implement it since you can technically get away without it as long as your users or mail client know what to do to make it work. – bgp Nov 14 '16 at 5:54
  • 3
    The "problem" with email is that the client settings are a bit more elaborate than just a host/protocol, some ISP's use the complete email address as the loginname, others just the user part or the login name may not even resemble the email address. There are a number of different password hashing algorithms, services on either a dedicated SSL ports, or STARTTLS on the same port as the traditional clear text protocol, POP before SMTP vs SMTP authentication etc. – HBruijn Nov 14 '16 at 10:29
  • 4
    Some of those things are specified in RFC 6186 - not that it necessarily helps if you don't know whether the server follows the standard, of course. – legoscia Nov 14 '16 at 11:40
1

Not aware of any standard per-se, but in DNS terms, you'd generally just register the "well-known name" imap.example.com and perhaps also imaps.example.com

SRV records are for much later / more complex things. Eg. finding Active Directory servers for a domain, or used as part of DNS Service Discovery.

History is littered with various service advertisement / discovery mechanisms.

| improve this answer | |
  • Actually, SRV records were intended for to be usable and be used by nonstandard or inhouse applications/protocols (complexity or simplicity was not a factor). I believe it's been fairly successful for that. Its original raison d'etre was related to an expensive embedded device. – arnt Jun 6 '19 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.