I am trying to access my company mail id (the mail provider is Gmail) inbox using IMAP. I have applied almost all the possible solutions available here and also on google. But I am facing the same issue.
These are the some solutions which I tried,
- allow less secure app access Gmail
- enabled IMAP access from Gmail
- added novalidate-cert
Here's my code:
$hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$username = '[email protected]';
$password = 'mypassword';
// try to connect
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Tiriyo: ' .
imap_last_error());
Error message
Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX
in \path\to\file\index.php on line 12
I don't see where I'm going wrong. Please help...
Google has deactivated the regular login for third parties on 2022-05-31!
https://support.google.com/accounts/answer/6010255
It is now necessary to implement the Google PHP lib.
https://github.com/googleapis/google-api-php-client
https://github.com/googleapis/google-api-php-client/blob/main/docs/oauth-web.md
The option for less secure apps has also been removed by Google, which now also eliminates this possibility. https://myaccount.google.com/lesssecureapps