i am not able to open the imap function and i can't retrive the email from the mailbox...
and i am using this code

<?php
$name = 'jeetrajsah@gmail.com';
$pwd = '9871670594';

$mailbox = '{mail.google.com}INBOX';
$mbox=@imap_open ($mailbox, $name, $pwd);  
print_r(imap_errors()) 
?>

ad error occured is :

Warning: imap_open() [function.imap-open]: Couldn't open stream {mail.google.com}INBOX in c:\wamp\www\REMAIL\fetch_mail_view.php on line 13
Array ( [0] => Can't connect to googlemail.l.google.com,143: Timed out (10060) )

plz short out my problem as soon as possible...

Have you ensured the IMAP connections are allowed within your gmail account?

Go to gmail.com and check you account settings to ensure it's allowed.

Regards,
Alex

Also, when I connect to googlemail via IMAP I have used Port 993 using the following connection string:

$mbox_open = imap_open ("{imap.googlemail.com:993/imap/ssl}[Google Mail]/Sent Mail", "emailaddress@gmail.com", "password");

Also, when I connect to googlemail via IMAP I have used Port 993 using the following connection string:

$mbox_open = imap_open ("{imap.googlemail.com:993/imap/ssl}[Google Mail]/Sent Mail", "emailaddress@gmail.com", "password");

hello friends ...
i am using urs code but is it not working correct ..that code occuring error like..


Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.googlemail.com:993/imap/ssl}[Google Mail]/Sent Mail in c:\wamp\www\REMAIL\fetch_mail_view.php on line 22
not connect


when i am using this code:--
$mbox_open = imap_open ("{imap.googlemail.com:993/imap/ssl}[Google Mail]/Sent Mail", "emailaddress@gmail.com", "password");

hi ..

i am not able to open to gmail through imap ..so plz give me suggestion ...how i open gmail and fetch the email... what i make a configuration ...because ssl is not working...

and i am using urs code.... but that code is not working properly..
so plz configure my problem as soon as possible...

I've tried this code myself and I can definately connect.

<?php
$name 		= 'emailaddress@gmail.com';
$pwd 		= 'password';

$mailbox 	= '{imap.googlemail.com:993/imap/ssl}';
$mbox		= imap_open ($mailbox, $name, $pwd);

$emails		= imap_headers($mbox);

foreach($emails as $header_text){
	echo $header_text.'<br/>';
}

?>

To connect to another mailbox e.g Sent Mail, etc you need to change the mailbox string to:

$mailbox 	= '{imap.googlemail.com:993/imap/ssl}[Google Mail]/Sent Mail';
This article has been dead for over six months. Start a new discussion instead.