I am trying to integrate IMAP on website, but i am stuck in the first itself. I am not able to establish the connection. The code that I used was:
$connect_to = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
//$connect_to = '{imap.gmail.com:993/imap/ssl}INBOX'; tried this method also
$user = 'abc@gmail.com';
$password = 'abc123';
$connection = imap_open($connect_to, $user, $password)
or die("Can't connect to '$connect_to': " . imap_last_error());
imap_close($connection);
I checked the firewall, authentication from gmail, allowed less secure app from gmail end, but everytime i am getting this error
Can't connect to '{imap.gmail.com:993/imap/ssl}INBOX': Can not authenticate to IMAP server: [ALERT] Please log in via your web browser: https://support.google.com/mail/account
Can anyone please tell why this is happening and how can i rectify it. I also would like to know is there a way where i can allow all web mails together, currently its only for gmail but i would like it to work for all server such as yahoo, hotmail, aol etc