Hi,
I recently installed the new osTicket 1.17.5 and noticed an issue where emails fetched from Gmail using IMAP and OAuth2 are not being fully processed. Some emails are missing in the ticket system. While I initially thought it was a Gmail issue, the problem does not occur on our old system (version 1.15).
I’ve observed a pattern: most emails are being fetched, but it skips one email consistently. The log entry states: "The single ID was not found in response."
After some investigation, I identified that the issue originates in the foreach loop within the processEmails function in include/class.mailfetch.php. It appears that when accessing IMAP using IDs, after calling markAsSeen and moveMessage, the current email shifts in the list, causing the next email to be skipped.
I didn’t have time to dig deeper today, so I implemented a rough workaround:
1, Commented out the foreach loop.
2, Added a while loop to continuously process the current email (always positioned at index 1).
Noticed that, for some reason, the first email gets processed twice, so I added an offset to skip one additional email.
This is just a temporary solution. I’ll provide updates if nobody else looks into this issue.
Attached is the installation information: