bhavya Posted December 18, 2009 Share Posted December 18, 2009 <html> <head> <script language="php"> function show_mails($server, $account, $password) { $mailbox = imap_open("{".$server.":995/pop3}INBOX", $account, $password); $mails = imap_fetch_overview($mailbox,"1:*", FT_UID); // This is fetching an overview of all emails // Output as a table: $return = '<table width="100%"> <tr> <td><b>#</b></td> <td><b>From</b></td> <td><b>Date / Time</b></td> <td><b>Subject</b></td> </tr>'; $size = count($mails); // Number of messages $cmsg = 0; // This is used to have a continously number for($i=$size-1;$i>=0;$i--) { $cmsg++; $value = $mails[$i]; $return .= '<tr><td>'.$cmsg.'</td><td>'.$value->from.'</td><td>'.$value->date.'</td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$value->msgno.'">'.$value->subject.'</a></td></tr>'; } $return .= '</table>'; imap_close($mailbox); return $return; } function show_mail($id, $server, $account, $password) { $mailbox = imap_open("{".$server.":995/pop3}INBOX", $account, $password); $mail = imap_body($mailbox,$id, FT_UID); // This is fetching the email.. $mail = htmlentities(stripslashes($mail)); /* stripslashes is stripping the slashes, htmlentities transforms all of the non-regular symbols to their equal html code expression. */ $return = '<pre>'.$mail.'</pre>'; imap_close($mailbox); return $return; } if(isset($_GET['id'])) if(is_numeric($_GET['id'])) echo show_mail($_GET['id'], "pop.gmail.com", "[email protected]", "1a2b3c4d"); else echo 'wrong parameter'; else echo show_mails("pop.gmail.com", "[email protected]", "1a2b3c4d"); </script></head> </html> Error: arning: imap_open() [function.imap-open]: Couldn't open stream {pop.gmail.com:995/pop3}INBOX in C:\xampp\htdocs\rajesh.php on line 6 Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\rajesh.php on line 6 Can anyone please help me. Link to comment https://forums.phpfreaks.com/topic/185559-imap_open-error/ Share on other sites More sharing options...
teamatomic Posted December 18, 2009 Share Posted December 18, 2009 If the server and port are correct then you have bad user/pass. Can you telnet to the mail server. Link to comment https://forums.phpfreaks.com/topic/185559-imap_open-error/#findComment-979648 Share on other sites More sharing options...
bhavya Posted December 18, 2009 Author Share Posted December 18, 2009 I got it i just included ssl after pop3 now its working imap_open("{".$server.":995/pop3/ssl}INBOX", $account, $password); Link to comment https://forums.phpfreaks.com/topic/185559-imap_open-error/#findComment-980232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.