To fetch gmail mails, i am using below code. it is working fine in local, but i am getting error in server like :
Warning: imap_open(): Couldn't open stream {imap.googlemail.com:993/imap/ssl/novalidate-cert}INBOX in C:\xampp\htdocs\criticaloglive\email_real.php on line 10 Cannot connect to Gmail: Too many login failures
Here's my code :
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$server = '{imap.googlemail.com:993/imap/ssl/novalidate-cert}INBOX';
$username = 'mymail@gmail.com';
$password = 'mypassword';
// try to connect
$inbox = imap_open($server,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
Use the $hostname instead of $server. also try with not secure imap with port 143
$inbox = imap_open($hostname,$username,$password) ;
this code works for me.