DonnieG Posted March 6, 2013 Share Posted March 6, 2013 <?php $mbox = imap_open("{imap.gmail.com:993/ssl/novalidate-cert}INBOX", "myemail@gmail.com", "PASSWORD"); $old_msg_numbers = imap_search($mbox, ""); echo "This should report the message numbers retrieved from GMail\r\n"; var_dump($old_msg_numbers); echo "\r\nimap_errors:\r\n"; var_dump(imap_errors()); echo "\r\nimap_alerts:\r\n"; var_dump(imap_alerts()); imap_close($mbox); phpinfo(); ?> When I run this locally on my Windows machine, with XAMPP and PHP, it runs and works properly. any time I give it to a hosting company, it doesn't run, instead it generates the PHP warning here: PHP Warning: imap_open() [<a href='function.imap-open'>function.imap-open</a>]: Couldn't open stream {imap.gmail.com:993/ssl/novalidate-cert}INBOX in /path-goes-here/test.php on line 3 I have used this on two different hosting providers, hostmonster.com and godaddy.com, they say they are not blocking port 993, which GMail requires. Using Port settings defined by Google ( http://support.google.com/mail/bin/static.py?hl=en&ts=1668960&page=ts.cs&rd=1 ), and that shouldn't matter, because its working fine on my local machine. What do? Quote Link to comment https://forums.phpfreaks.com/topic/275295-imap_open-couldnt-open-stream-with-gmail-but-works-locally/ Share on other sites More sharing options...
Ken_GoDaddy Posted March 13, 2013 Share Posted March 13, 2013 @DonnieG I'm with Go Daddy and came across your post. Is this script on a shared hosting or virtual/dedicated server environment? If your on a shared hosting account and are trying to get it to send emails from mail-forms etc you will want to use our SMTP relays available for your hosting account. http://support.godaddy.com/help/article/345/what-is-smtp-relay http://support.godaddy.com/help/article/951/what-email-or-relay-server-should-i-use-in-my-php-code If your on a Virtual/Dedicated server and are still running into the issues please let me know. Feel free to reply or to send me a private message. Quote Link to comment https://forums.phpfreaks.com/topic/275295-imap_open-couldnt-open-stream-with-gmail-but-works-locally/#findComment-1418283 Share on other sites More sharing options...
krsitenmorey111 Posted July 8, 2013 Share Posted July 8, 2013 (edited) <?php $mbox = imap_open("{imap.gmail.com:993/ssl/novalidate-cert}INBOX", "myemail@gmail.com", "PASSWORD"); $old_msg_numbers = imap_search($mbox, ""); echo "This should report the message numbers retrieved from GMail\r\n"; var_dump($old_msg_numbers); echo "\r\nimap_errors:\r\n"; var_dump(imap_errors()); echo "\r\nimap_alerts:\r\n"; var_dump(imap_alerts()); imap_close($mbox); phpinfo(); ?> When I run this locally on my Windows machine, with XAMPP and PHP, it runs and works properly. any time I give it to a hosting company, it doesn't run, instead it generates the PHP warning here: PHP Warning: imap_open() [<a href='function.imap-open'>function.imap-open</a>]: Couldn't open stream {imap.gmail.com:993/ssl/novalidate-cert}INBOX in /path-goes-here/test.php on line 3 I have used this on two different hosting providers, hostmonster.com and godaddy.com, they say they are not blocking port 993, which GMail requires. Using Port settings defined by Google ( http://support.google.com/mail/bin/static.py?hl=en&ts=1668960&page=ts.cs&rd=1 ), and that shouldn't matter, because its working fine on my local machine. What do? Even this code not working locally :/, can you please let me know who can I execute it properly? I have enable php_imap and php_openssl in my wamp server php setting, I am using "wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-32b" Edited July 8, 2013 by krsitenmorey111 Quote Link to comment https://forums.phpfreaks.com/topic/275295-imap_open-couldnt-open-stream-with-gmail-but-works-locally/#findComment-1439860 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.