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"



I even tried the following but the same error.

{}[Gmail]/All Mail



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


source to share

1 answer

try it

$hostname = "{}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.



All Articles