mirror of
https://github.com/cypht-org/cypht.git
synced 2026-04-25 13:05:53 +03:00
[GH-ISSUE #1402] 🐛 [Bug] Gmail messages not shown #648
Labels
No labels
2fa
I18N
PGP
Security
Security
account
advanced_search
advanced_search
announcement
api_login
authentication
awaiting feedback
blocker
bug
bug
bug
calendar
config
contacts
core
core
devops
docker
docs
duplicate
dynamic_login
enhancement
epic
feature
feeds
framework
github
github
gmail_contacts
good first issue
help wanted
history
history
imap
imap_folders
inline_message
installation
keyboard_shortcuts
keyboard_shortcuts
ldap_contacts
mobile
need-ssh-access
new module set
nux
pop3
profiles
pull-request
question
refactor
release
research
saved_searches
smtp
strategic
tags
tests
themes
website
wordpress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cypht#648
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @indridieinarsson on GitHub (Dec 9, 2024).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/1402
Originally assigned to: @christer77 on GitHub.
🐛 Bug
I have an install using sqlite database, redis and memcached enabled, running as a docker image.
I have 3 different accounts, one of them gmail. The other two accounts (on two separate and different servers) work as expected, both in single-mailbox mode (under the Email tab) and in the combined views.
Gmail, on the other hand has problems. After restarting cypht, it works, showing me mails in single-mode and in the combined views.
After just a few navigations, cypht stops showing any messages from my gmail account.
That goes for both viewing the gmail INBOX directly (which shows no messages, although there are thousands) and also the combined views, which show no message from the gmail account, only from the other two.
It may be of importance here, that my gmail inbox is pretty huge, containing my entire email history for years.
Version & Environment
Rev:
412b5adbd9OS: Linux x86 / docker
@indridieinarsson commented on GitHub (Dec 10, 2024):
I analysed this a bit. Cypth (modules/imap/hm-imap-base.php) is successfully communicating with gmail. Getting settings, and the list of messages. All of it, the first timestamp is 2006. My guess is that it then goes on to fetch a whole lot of messages and something times out, but I haven't confirmed that yet. My feeling is that gmail is not answering imap requests very fast (throttling them even).
Now, perhaps, I should tidy up my inbox, but then again, I'm hardly the only one using the search function instead of organized folders...
It's also worth noting that (at least a couple of weeks ago) everything worked ok on a mailbox which is a mirror of my gmail box. But that one is faster.
@indridieinarsson commented on GitHub (Dec 11, 2024):
I looked a bit into this. I see the following imap command being sent to gmail imap server :
A8 UID FETCH 53418,53419,53420,53421,53422,53423,53424,53425,53429,53432,53436,53437,53438,53439,53440,53441,53442,5 3443,53444,53445 (FLAGS INTERNALDATE RFC822.SIZE X-GM-MSGID X-GM-THRID X-GM-LABELS BODY.PEEK[HEADER.FIELDS (SUBJECT X-AUTO-BCC FROM DATE CONTENT-TYPE X-PRIORITY TO LIST-ARCHIVE REFERENCES ME SSAGE-ID X-SNOOZED)] BODY.PEEK[0.1])which then yields the answer :
A8 BAD Could not parse command@indridieinarsson commented on GitHub (Dec 11, 2024):
Ok, it's
BODY.PEEK[0.1]that's causing this. Apparently not supported in this form by gmail. If I change it toBODY.PEEK[1], then it works.And also if I disable the preview mail option (which controls the
BODY.PEEKimap option), then i get gmail messages again.@indridieinarsson commented on GitHub (Dec 17, 2024):
Follow up : after disabling preview mail option (and also locally changing BODY.PEEK[0.1] to BODY.PEEK[1]), things only sort-of work. If I nuke local cache in the browser, I get gmail message in the "Everything" view.
However, after a while, when I refresh the view, the gmail messages are no longer there (but the others are). The dedicated gmail Inbox still has all the gmail messages (but the "Everything" view is sort of the best feature of cypht...)
@christer77 commented on GitHub (Dec 19, 2024):
Hello @indridieinarsson,
thank you for raising the issue,
thank you also for the proposed solution.
We get to it and get back to you early.
@indridieinarsson commented on GitHub (Dec 19, 2024):
Hi,
thanks for looking into it. And my "solution" isn't really a solution yet, as it goes only from "never works" to "works for an hour then no more".
@indridieinarsson commented on GitHub (Dec 19, 2024):
Now, I'm tracking this a bit. Seems that the xoauth2 logon is unsuccessful. In hm-imap.php, I am landing here:
the base64 encoded json string in the reply says :
{"status":"400","schemes":"Bearer","scope":"https://mail.google.com/"}which is a bit weird, since I'm successfully logged into gmail imap server if I go to the dedicated gmail inbox. Also "Everything" view successfully logged in an hour earlier.
@indridieinarsson commented on GitHub (Dec 19, 2024):
So, it appears that this is caused by the oauth2 bearer token expiring.
When I'm in the "gmail dedicated" inbox, there is a function
imap_refresh_oauth2_tokenwhich is regularly being called to check validity of the oauth2 token, and refresh it if needed.When in the "Everything" view, this function never gets called, so the token expires (after an hour) and subsequent login attempts are refused.
If I navigate to the gmail-inbox, the token is refreshed, and I can enjoy one more hour of "Everything" view with everything actually in it, but then it expires again.
@christer77 commented on GitHub (Dec 20, 2024):
seen somewhere
@christer77 commented on GitHub (Dec 20, 2024):
RFC
@christer77 commented on GitHub (Mar 20, 2025):
HI @indridieinarsson ,
can you mark this issue as resolved please?
@indridieinarsson commented on GitHub (Mar 20, 2025):
fixed with PR #1409