Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.4

Bug #18768 failed to connect to Gmail (start TLS)
Submitted: 2011-08-30 14:25 UTC
From: lazutov Assigned: doconnor
Status: Closed Package: Net_IMAP (version 1.1.0)
PHP Version: 5.2.9 OS: Debian
Roadmaps: (Not assigned)    
Subscription  


 [2011-08-30 14:25 UTC] lazutov (Alexander Lazutov)
Description: ------------ Hello! There is a problem while connecting to google/gmail. You need to ENABLE crypto before sending anything SOLUTION: in cmdConnect before PEAR::isError($this->_getRawResponse()) add if ($enableSTARTTLS) if (!$this->_socket->enableCrypto(true,STREAM_CRYPTO_METHOD_TLS_CLIENT)) return new PEAR_Error('Failed to set crypto'); This worked for me. Hope the maintainers will use this in future development. Have a nice day! Regards, Alexander N Lazutov Test script: --------------- define ('SRV','imap.gmail.com'); define ('PRT',993); define('LOGIN','lazutov@gmail.com');define('PASS','<somepwd>'); define('SSL',true); require_once 'IMAP.php'; $imap = new Net_IMAP(SRV, PRT, SSL); $imap->setDebug(true); $imap->setTimeout(5); if ( PEAR::isError( $ret = $imap->login( LOGIN , PASS, false ) ) ) { echo "Unable to login! reason:" . $ret->getMessage() . "\n"; exit(); } Actual result: -------------- Timeout while doing cmdConnect point PEAR::isError($this->_getRawResponse())

Comments

 [2011-09-02 14:41 UTC] mesuterdemir (Mesut Erdemir)
Hi lazutov, crypto method also works for me to. Thanks. But $enableSTARTTLS gives not defined error in apache logs. I replace this line to; if($port == 993) if (!$this->_socket->enableCrypto(true,STREAM_CRYPTO_METHOD_TLS_CLIENT)) return new PEAR_Error('Failed to set crypto'); Thanks again ;)
 [2012-01-02 07:40 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: doconnor
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.