XNA_developer_group
XNA_developer_group

Reputation: 87

Connection to gmail with imap error

I am trying to make a mail appliction in php with imap and gmail. I am using a free hosting site, http://powrhost.com/, and imap, ssl, and all the other stuff are installed on it. My login code is:

/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$username = '*************@gmail.com';
$password = '**************';

/* try to connect */
 $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' .   imap_last_error());

I know that everything is okay except I don't know if my host allows port 993. Is there a better free hosting that it will work or is my code wrong? BTW, no shell access. The error is: could not stream imap connection: timeout

Upvotes: 2

Views: 1983

Answers (1)

Keyur Padalia
Keyur Padalia

Reputation: 1138

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.

Upvotes: 1

Related Questions