SRV Records Simplify Mail Client Configuration
If you’ve configured an “Other” email account (besides the handful of pre-configured partners) on a shiny new iDevice or Apple’s Mail.app, you may have noticed that it doesn’t initially ask for the SMTP and IMAP or POP server names. This is because it can look those up automatically, if the domain name on the right side of your email address has published SRV records in DNS.
The IETF standard describing these records, written by Cyrus Daboo at Apple, was published recently as RFC 6186. Earlier drafts have been floating around for a couple years, and SRV records date back to 1996 (updated in 2000.)
SRV is another type of DNS record, like A for hosts, MX for mail routing, and TXT for random bits of textual data. They’re intended as a way to indicate that a service associated with a DNS domain can be found on a particular host and port; for example, to find the LDAP directory service for example.com, you could look at the SRV record of _ldap._tcp.example.com.
(SPF and DKIM use TXT records because there wasn’t any other obvious place to put that information, but DKIM borrowed the SRV convention of placing an underscore character at the beginning of the name in order to distinguish it from hostnames.)
The IMAP, POP, and SUBMISSION services could’ve been identified with SRV records all along, but it never caught on. Now, RFC 6186 provides additional guidance for both mailbox providers and email client developers.
The services described are:
“_submission” for an authenticated SMTP submission & relay service, usually listening on port 587.
“_imaps” and “_imap” for IMAP with or without TLS encryption, usually port 993 or 143 respectively.
“_pop3s” and “_pop3” for POP with or without TLS encryption, usually port 995 or 110 respectively.
SRV records also allow for some simple load-balancing and prioritization. This specification extends that somewhat, describing how a mailbox provider could suggest that mail clients try (for example) the IMAPS service first, then IMAP.
Like MX records, these SRV records may point to services hosted at an entirely different domain — or, for load-balancing, multiple different domains. So even a domain which has outsourced their email to a hosting company can still take advantage of the ease of configuration provided by these records.
I’ve heard that some DNS hosting companies don’t permit underscores, complaining that underscores aren’t allowed in hostnames. They’re right, but SRV records (and DKIM TXT records) aren’t hostnames — they’re services. Unfortunately, if your DNS host’s software can’t handle it and they won’t change it, the only advice we can offer is to find another provider.