I configured gmail to get connected to imap.gmail.com in my web application. To do so I enable imap access and allowed to access the less secure app. But still I could not get connected to gmail imap.
first I tried -
imap_open('{imap.gmail.com:993/imap/ssl}INBOX','gmailaccount','password')
or die('Cannot connect to Webmail: ' . imap_last_error());
This gives error of Certificate failure for imap.gmail.com: unable to get local issuer certificate: /C=US/O=Google Trust Services/CN=Google Internet Authority G3 and I tried with novalidate-cert
option which comes with vulnerability. And the code is -
imap_open('{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX','gmailaccount','password')
or die('Cannot connect to Webmail: ' . imap_last_error());
This gives error - Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure) even username and password are correct.
Actually, I want to connect with providing certificate. I googled - "How to issue certificate for GMAIL IMAP connection", but nothing useful there. What's wrong with this code while it's perfectly working with other web account. What should I do make it workable.