Use SRV records to discover server address

The idea would be to autofill the server details in the setup wizard.

See https://tools.ietf.org/html/rfc6186

Assigned to
1 year, 4 months ago
1 year, 2 months ago
feature good first ticket

~sircmpwn referenced this from #163 1 year, 3 months ago

~rassouly 1 year, 3 months ago

Sadly I wasn't able to find a single email provider that has working SRV records apart from Gmail. Mozilla has a page explaining how the autoconfiguration works for thunderbird. TL;DR, they mostly rely on a database (ISPDB) that they have to constantly update. They also provide free access to that centralized database at https://autoconfig.thunderbird.net/v1.1/. It's not a perfect solution but Mozilla says that they add every ISP with a market share of more than 0.1% and that alone autoconfigures more than 50% of all email addresses.

~zachs 1 year, 3 months ago

I'm wondering if we can't just use a DNS lookup utility to do this instead of using a database. You can test this using host or nslookup. For example, if you were setting up an account from fastmail.com you would run the following lookups:

host -t srv _imaps._tcp.fastmail.com
host -t srv _imap._tcp.fastmail.com
host -t srv _pop3s._tcp.fastmail.com
host -t srv _pop3._tcp.fastmail.com

And get the following back:

_imaps._tcp.fastmail.com has SRV record 0 1 993 imap.fastmail.com
_imap._tcp.fastmail.com has SRV record 0 0 0 .
_pop3s._tcp.fastmail.com has SRV record 10 1 995 pop.fastmail.com
_pop3._tcp.fastmail.com has SRV record 0 0 0 .

Based on the linked spec, _imaps has a lower priority value than _pop3s (0 vs 10), so _imaps is preferred. From this we can populate the target FQDN and port (in this case imap.fastmail.com and 993) and continue with the setup wizard.

Does that reason test? I'm just going off the specification document.

~emersion 1 year, 3 months ago

Yes, this is how it should be implemented. POP isn't supported anyway so we can just skip that. net.LookupSRV can be used to retrieve those SRV records.

~quite 1 year, 3 months ago

Patch mailed, not automatic referencing yet? https://lists.sr.ht/~sircmpwn/aerc/patches/6357

~sircmpwn REPORTED IMPLEMENTED 1 year, 2 months ago

Register here or Log in to comment, or comment via email.