Autodetect imap smtp settings

Hello,

First of all, thanks a lot for this awesome app! This app is free software and just works very well and is super userfriendly! I could install it on phones of non technical people :wink:
But I noticed one issue. For one domain I manage, the imap and smtp settings are automatically detected on Thunderbird but not in K9-Mail. While this isn’t a big issue, could this be improved in some way?

I will explain more the issue I had :slight_smile:
To connect to the email address contact@domain.com Thunderbird automatically detects that imap and smtp are locate at the domain domain.com while K9-Mail sets the imap and smtp subdomains. When doing the automatic parameter detection nothing is changed. I know some dns entry could maybe help K9-Mail to work, but Thunderbird managed to configure it successfully without more dns entries, so it would be cool if K9 did it as simply!

Thanks for your comments!

1 Like

Should I rather ask/open an issue on github?

MUAs like Thunderbird and Outlook check DNS for setup information first. If they don’t find the information, they’ll ask the user. These manual settings are then transferred to servers operated by Mozilla/M$/… (potentially illegally in Europe as users are not made aware of this)

When sufficiently many users have manually set the same settings, Thunderbird and Outlook will start “automatically detecting” the settings by retrieving them from the Mozilla/M$/… servers.

I do not think K-9 operates such “settings servers,” nor should the project do so. As mentioned, there is a liability issue with user data from Europe.

I recommend that you write MS or Microsoft instead. Bashing companies can be done in other places. Or not at all. :slight_smile:

Well thanks @tchara for your comment, but as I explained in my first post, my email server is on a “new” custom domain, so Mozilla can’t be aware of the settings as nobody had entered manually the settings of this domain already.
So Thunderbird has probably, as you said, checked the dns, to retrieve information and it would be cool if K9 could do the same :slight_smile:

Thunderbird might also just “brute force” common settings such as subdomains (mail, smtp, imap, pop, pop3, …) as well as ports and security settings (993/StartTLS, 993/SSL, …).

Personally, I think this should not be done, even though it’s convenient. It can trigger overly strict firewalls and lead to false IP reports if combines with OWASP and badip.

Well I’m not an expert on this topic, so I don’t have a strong opinion.
But if Thunderbird is doing like this, they might have good reasons and have thought about possible drawbacks.

The standards-based way to do this is with the DNS “SRV” record (see: https://datatracker.ietf.org/doc/rfc6186/). Any other approach is basically brute force, and should really be discouraged.

I found that gmail publishes SRV records:

dig +short srv _submission._tcp.gmail.com
5 0 587 smtp.gmail.com.

dig +short srv _imaps._tcp.gmail.com
5 0 993 imap.gmail.com.

dig +short srv _pop3s._tcp.gmail.com
20 0 995 pop.gmail.com.

but didn’t find them for any other major mail service provider (MSP). If your MSP has SRV records, then it might be reasonable to put in a K-9 enhancement request. If it doesn’t, start by asking them to add SRV records. [I haven’t looked at the K-9 code to see if it already does SRV record discovery,]

2 Likes

Well it looks like autoconfiguration is coming: Revealed: Our Plans For Thunderbird On Android

I know this is an older topic, but the primary mechanism for Thunderbird’s autodiscovery wasn’t mentioned, and someone else might stumble over this:

https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat

It’s just a small xml file, retrieved from a webserver, that tells Thunderbird (and Evolution, KMail and Kontact) how to configure the server settings.

Thunderbird will try to fetch this file from multiple possible locations, based on the email domain. No brute force required. (Well, yes if you consider a DNS query and one HTTP GET brute force, lol.)

It would be really nice if K9 Mail suppported this mechanism, too.

1 Like

This is already supported in the latest beta version. See How do I become a beta tester?

1 Like

Hi, I am very excited about this feature. But by reading the source code, it seems that the autoconfig query based on SRV records is not enabled? May I ask if your team is planning to support it later?

Correct.

At some point, yes.