The idea would be to autofill the server details in the setup wizard.
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.
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
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,
_imapshas a lower priority value than
_pop3s(0 vs 10), so
_imapsis preferred. From this we can populate the target FQDN and port (in this case
imap.fastmail.comand 993) and continue with the setup wizard.
Does that reason test? I'm just going off the specification document.
Yes, this is how it should be implemented. POP isn't supported anyway so we can just skip that.
net.LookupSRVcan be used to retrieve those SRV records.
Patch mailed, not automatic referencing yet? https://lists.sr.ht/~sircmpwn/aerc/patches/6357