PHP IMAP mail access not working in Gmail

I am using the following server to connect to Gmail IMAP, but it says "Unable to open mailbox: no such mailbox"

{imap.gmail.com:993/ssl/novalidate-cert}

      

I even tried the following but the same error.

{imap.gmail.com:993/ssl}[Gmail]/All Mail

{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX

      

The email account exists and IMAP is also enabled in my Gmail.

+3


source to share


1 answer


try it

$hostname = "{imap.gmail.com:993/imap/ssl}INBOX";
$username = $imap_user;
$password = $imap_password;
$inbox = imap_open($hostname, $username, $password);//Open Mailbox

      



To access any other mailbox like Archive you just change the INBOX to archive or whatever folder name and I think those folder names are case sensitive.

This works for me.

+1


source







All Articles