Jump to content

PHP, IMAP, and gmail


Recommended Posts

I'm having some problems with gmail's IMAP.

 

Here's my sample code:

<?php
// Connection
$server = "imap.gmail.com";
$user   = "[email protected]";
$pass   = "MYPASS";
$conn   = imap_open("{".$server.":993/imap/ssl}INBOX", $user, $pass) or die("Error: " . imap_last_error());
?>

 

This works fine when I run it on my localhost server, but when I upload it to my other server (hosted by hostgator), I get this error:

Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX in /home/path/to/imap.php on line 9

Error: Can't connect to gmail-imap.l.google.com,993: Connection refused

 

Both servers have IMAP enabled. And yes, I have turned IMAP on in my gmail settings. What could be causing the problem?

 

Wes

Link to comment
https://forums.phpfreaks.com/topic/113155-php-imap-and-gmail/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.