Trouble with gmail accounts in the default email app

I’ve recently started having trouble with my gmail accounts configured in the default /e/OS mail application.

They worked fine for about a month, but last week one of the accounts suddenly refused to authenticate on the SMTP server (outgoing emails), while the incoming emails were still downloading fine. The error was "username or password incorrect (assuming the error message was coming directly from google, as it contained a link to a google help page with troubleshooting steps for when you input the wrong credentials).

Thinking I have inadvertently screwed up some settings in the accounts section (I had recently removed calendar and contacts sync’ing), I removed both gmail accounts from the mail app and both mail accounts from settings (Passwords & accounts) and set them up from scratch.

They worked fine for a few days but then one account stopped receiving emails and 2 days later the other account stopped as well. If I test my outgoing server I get the same message as above, and If I test my incoming server I get a similar message (see below):

“Username or password incorrect. (Command: AUTHENTICATE OAUTHBEARER, response: #2# [NO, [AUTHENTICATIONFAILED], Invalid credentials (failure)])”

It almost looks like the app fails to renew its OAUTH authentication token. I know it’s not a google issue, as I also connect (via OAUTH 2.0) to these accounts from a desktop mail app which is still receiving and sending emails successfully.

Anybody has any ideas? Any way I can turn on further logging in /e/OS MAIL app to get more info?

Samsung S10+
/e/OS 1.5.1-s-20221102231515-dev-beyond2lte

Regain your privacy! Adopt /e/ the unGoogled mobile OS and online servicesphone

I also got similar troubles with my professional Gmail account about 1 month ago.

Finally I removed my Gmail account from the email app and downloaded Gmail app + Google calendar app, and now it’s working fine.

I also hope a future update will fix this so that I will be able to use my Gmail directly in email + calendar app again…

Something new that I discovered (might not be the whole cause of my troubles, but it’s definitely part of the problem): if I play with the default settings for Push folders and/or Pull folders items in the account settings menu, Fetching mail submenu, the mail app eventually stops sync’ing emails from gmail (usually it seems to take 1-2 days before the sync stops). I tried resetting these settings to default and suddently the mail client re-started sync’ing new messages from gmail.

Same problem here on a Fairphone 4. I could not describe it better as you did!
Sadly, I have tried to play around with the settings and removed the account many times, without spotting the causing the error.
However, suddenly things have started to work this morning, for no apparent reasons (no updates).

I am on /e/OS 1.5.1-s-20221102231514-stable-FP4

Unfortunately, it seems this was just a temporary fix - after a couple of days, the mail client stopped receiving mails again.

There’s something very wrong in its OAUTH implementation (methinks).

Will wait for future app updates - hopefully this is a bug which will be found/solved in future versions of the app.

I ended up giving up on the default mail app in /e/OS and installing K9 Mail directly, for two reasons:
1 - I am hoping K9 mail will not have the same issues as the default mail app (even though this is a fork of it) as it is a newer version and it worked perfectly with gmail accounts on my old android phone
2 - as soon as you configure a gmail account in the default mail app, the os takes over the account sync (contacts, calendar, etc) and requests full access to google. If you configure a gmail account in K9, it does not appear under settings/accounts and it only requests email access privileges.

Will report in a month or so, as to wether K9 mail continues to work fine or will crap out like the /e/OS default mail client

to your (1): while Mail is a fork, the Oauth parts are handled in the accountmanager due to a design decision. Sure this can introduce behaviour unknown upstream.

yes, (2) can also be an anti-feature to enable all sync classes beyond mail (calendar, addresses). Does warrant a separate bug ticket to highlight this.

Reading this thread I wonder if an error is silently ignored / not shown to the user. Or the token would need to be refreshed / or you reached a rate limit silently.

Could you review how often you poll and change to more efficient IMAP IDLE push? check (and reduce?) intervals with other sync classes as Contacts/Calendar

Looking at the issue tickets

1 Like

After further investigation, now I’m inclined to think it’s a app bug rather than a failure of the OAUTH token refresh process, for the following reasons:

  • sync has been at 1h for each mail account since the beginning (while it was working, when it broke and afterwards)
  • I’ve already tried various IMAP idle push numbers and it didn’t seem to affect this issue
  • just changing push/poll folders config brought it back to life instantly, but 2-3 days later is started failing to sync emails again (which points to an app bug, in my book).
  • google tells me the account manager session is still logged in (while I get the errors to connect to either incoming or outgoing mail servers), so the auth token should still be valid
  • while the app is in this “broken” state, the accounts page in settings is still able to properly authenticate to google and gives no errors.

However, irrespective of the above issues, just for reason #2 above, I’ll stick with K9 mail - I do not want the OS to handle various individual online accounts and I want to be able to choose if the phone or any app installed, should be able to see (or not) various components of my google account (for obvious privacy reasons).

3 Likes

By the way, after some while it suddenly stopped working again.
There was a recent update (now I am on e/ 1.6-s), which I was hoping to settle things, but I was wrong, in fact the problem is persisting.

Hi!
I added my girldfriends gmail account to the mail app on her new /e/ phone (she wanted it, hach…) and it works so far, but she gets all the gmail emails twice?
Cant find a setting that indicates its the problem, also the account exists just once. Any ideas what to try? Except from removing it and redo? :slight_smile:

I’ve been using the K9 mail app since last year and no more issues with failed authentication or double emails, anymore.