I had set up K9mail with Google by the “allow less secure apps” feature and it did work.
As Google will disable less secure apps by the end of May, I decided to move to an app password.
(I also have an app password for my yahoo account and this works without problems)
I did set up 2-factor auth for my Google account and created an app password.
When I entered it in K9 mail I got:
Setup could not finish
Cannot connect to server
(* OK Gimap ready for requests from …
I created another app password, and it did not work either.
My old less secure access does not work anymore too and I am stuck.
Is this a temporary problem, or do I need to do something else to get access to my gmail account?
Unless you have a connectivity issue, a “Cannot connect to server” error implies that some aspect of your hostname/security/port settings are not quite right. Could you provide what you are using for your incoming and outgoing server configurations, as well as your K9 version.
Thanks for the reply
Here is some background information.
I am in the process of configuring a new Lenovo P11 tablet.
As I mentioned, my yahoo account works well with the app password I needed to create for the Lenovo.
The same was with my Google account which I did set up first place with the settings for the less secure app.
Thus, I do not see any issue with hostname/security/port settings on my side.
After I had received a warning from Google, that they will disable less secure apps after May, I switched to the 2-step verification.
I again tried today with a newly generated app password, but the error message is the same.
So it doesn’t seem to be a short term problem on the Google side.
My K9 Mail Version is 5.807
Aside from the app password, I did not change any of the server configuration settings which previously worked with the less secure app connection (see screenshots).
Is there a change required to get it to work with K9?
Nothing “special” is needed on the email client (including K9) side to use an “app-password”. A password - regardless of how it is generated - is a password. You just need to enter the Google-generated app-password in your configuration in place of the one of your choosing.
The configuration you are showing for your incoming server settings indicates that you are using K9 as a pop client (see the “POP3 server” indication above the server hostname), however you are then trying to reach the gmail imap server (on the correct imap port). The imap and pop3 protocols are different and I don’t believe that an imap server (even gmail’s where they may be doing some things to try to make it “easy” for users) will understand the commands when connected to from a pop3 client. Gmail supports both imap and pop, but the pop server is at pop.gmail.com, port 995.
The other things that I noticed is that the passwords in your screenshot are suspiciously short, assuming that they are intended to be the google-generated app-passwords. The google-generated app-passwords are 16 lower-case alpha characters (displayed in 4-character blocks). K9 displays a single dot for each character in the password. Your image is showing passwords that are rather short of 16 characters - for both the incoming and outgoing configurations.
Oops, I never noticed that it says POP3 server above the server hostname.
I cannot find a setting for IMAP or POP3, though.
Thus, I suppose that the gray header line is just a hint and the protocol is derived from the server name and the port.
I have set all my mail accounts (7 in total) as IMAP, and they all show “POP3 server” above the server name.
The selection for imap/pop is at the start of the account setup process. If you select “imap” that tag will show “IMAP server”, if “pop”, “POP3 server”.
From what I’m seeing against my imap server, I don’t believe that K9 selects the protocol based on the port (using the hostname would be a fairly wild guess). I don’t have debug logging turned up very high, but when I set K9 as a pop client it fails authentication when using the imap port. The client handles mail very differently between imap and pop so letting a user switch protocol simply based on changing the server port number would require a lot of back-end “magic”, so it seems an unlikely option.
The K9 developer can weigh in on exactly what K9 does based on that initial account type selection.
When you’re not prompted to enter server settings the “automatic” account setup mechanism is used. In K-9 Mail 5.6xx and 5.8xx that means IMAP is used.
If the app doesn’t know the server settings for your account, you’ll be prompted which protocol to use, POP3 or IMAP.
The option you choose decides which protocol is used. There’s no additional protocol-selection logic. If your server settings screen says “POP3 server”, it’s a POP3 account, even if your server name is “imap.domain.example” and/or the port is 143 or 993.
K-9 Mail doesn’t support changing the protocol once an account has been created. If you wish to switch from POP3 to IMAP you have to delete the existing account and create a new one.
Aargh, that explains it.
I had exported all my K9 settings from my old tablet and imported them on my Lenovo, so I just needed to enter the account passwords to get it running.
Obviously, there is no way to change the account type after it has been set up, so I have all my accounts still configured as POP, although the server names are the IMAP names.
So I need to set up my accounts from scratch, but I cannot find a way to delete an account.
Long pressing an account under Settings / Accounts doesn’t seem to work, as it brings up nothing.
So I made up my mind and re-install K9 Mail from scratch.
Click the account on the settings screen and press the 3 dots in the top right.
@njeyaakili Woah, nice observations in your post. I would have never noticed that the password is too short to be an app password
Thank you all for your helpful support.
I have set up all my accounts from scratch and everything now works as expected.
Unfortunately, the hint about deleting an account came too late, but it will be helpful in the future.
@ergonom if this is solved for you may you can mark the correct answer as Solution.