Ali
Ali

Reputation: 1841

Accessing mail using IMAP in PHP not working for Gmail

I am using following server to connect to Gmail IMAP but it says "Can't open mailbox: no such mailbox"

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

I have even tried the following but same error.

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

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

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

Upvotes: 3

Views: 5887

Answers (1)

Keyur Padalia
Keyur Padalia

Reputation: 1158

Try This

$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 INBOX to Archive or what ever folder name is and i think this folder names are case sensitive.

It Works for me.

Upvotes: 2

Related Questions