Open haiderpro opened 1 year ago
I think the following code was incompatible for some reason: || print imap2_lasterror() when I removed it, it worked but still some complex IMAP tasks are showing different errors. I think they need more than simply replace imap with imap2_ or maybe it is Gmail's API that is going crazy day by day :-)
Ok found one big incompatibility which can be fixed simply by replacing the following code:
imap2_getsubscribed ($imap, '{imap.gmail.com:993/ssl/novalidate-cert}', '*');
with
imap2_getmailboxes ($imap, '{imap.gmail.com:993/ssl/novalidate-cert}', '*');
It looks like imap2_getsubscribed not exist in IMAP2 but you can get same results with imap2_getmailboxes
Your code is a life saver for most people but I think Gmail is going crazy day by day. It sometimes work with your code and sometimes not. Not sure why.
Seems like a problem with Gmail. It was working then after few searches it starts showing messages like following and don't work again. I tried both with access token and without it. I also tried disabling and enabling IMAP again but no use. Errors generated are like following:
Warning: Invalid IMAP connection parameter for imap2_search() at /home/sitename/public_html/orders/imap_nocc/test.php on line 129. Source code in /home/sitename/public_html/orders/imap_nocc/imap2/vendor/javanile/php-imap2/src/Errors.php on line 81
Connection seems successful and following is the code I used that generates above error message: $emails = imap2_search($HAimapConnection, 'SINCE "28 Oct 2022"') || print imap2_last_error();
If I use sort or any other command, it also generates same messages. Not sure why it stops working automatically. May be something wrong with Gmail servers?
-- Also just for your attention, your sandbox example at: https://phpsandbox.io/e/x/zwauf?layout=EditorPreview&defaultPath=%2F&theme=dark&showExplorer=no&openedFiles=
is generating following error: Parse error: syntax error, unexpected ':', expecting ')' in /var/repl.php on line 102 instead of shwowing any result.
Thanks for the great contribution for the PHP community.