smarcus3 Posted April 9, 2012 Share Posted April 9, 2012 I am trying to run this but it wont work. I get the following error. Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox in /home/u984345410/public_html/default.php Here is a snipit of the code function CountUnreadMails($login, $passwd) { $mbox = imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox", $login, $passwd, OP_READONLY); $count = 0; if (!$mbox) { echo "Error"; } else { $headers = imap_headers($mbox); foreach ($headers as $mail) { $flags = substr($mail, 0, 4); $isunr = (strpos($flags, "U") !== false); if ($isunr) $count++; } } imap_close($mbox); return $count; } Link to comment https://forums.phpfreaks.com/topic/260592-get-unread-gmail-messages-in-php/ Share on other sites More sharing options...
TimeBomb Posted April 9, 2012 Share Posted April 9, 2012 I've seen scenarios where the string: "{imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox" doesn't work, but: "{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX" works. Perhaps this may be your issue? Link to comment https://forums.phpfreaks.com/topic/260592-get-unread-gmail-messages-in-php/#findComment-1335553 Share on other sites More sharing options...
smarcus3 Posted April 9, 2012 Author Share Posted April 9, 2012 thanks but that didn't work. Still gives this error Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX in /home/u984345410/public_html/default.php on line 41 Link to comment https://forums.phpfreaks.com/topic/260592-get-unread-gmail-messages-in-php/#findComment-1335555 Share on other sites More sharing options...
smarcus3 Posted April 9, 2012 Author Share Posted April 9, 2012 I think it was due to the host I was using. Know of a host that allows the use of IMAP_OPEN???? Link to comment https://forums.phpfreaks.com/topic/260592-get-unread-gmail-messages-in-php/#findComment-1335558 Share on other sites More sharing options...
smarcus3 Posted April 9, 2012 Author Share Posted April 9, 2012 oh yeah a free host. Link to comment https://forums.phpfreaks.com/topic/260592-get-unread-gmail-messages-in-php/#findComment-1335560 Share on other sites More sharing options...
trq Posted April 9, 2012 Share Posted April 9, 2012 Ive said it before, but there is no such thing as a good free host. Anyway, we are not brining up this same subject again in another thread. See http://www.phpfreaks.com/forums/index.php?topic=117475.0 Link to comment https://forums.phpfreaks.com/topic/260592-get-unread-gmail-messages-in-php/#findComment-1335564 Share on other sites More sharing options...
Recommended Posts