pear accessing gmail
Posted: Sat Jul 19, 2008 11:26 pm
how can i access gmail's pop3 with pear?
i seem to have problem with ssl authentication as i ve no problem with non-ssl
source code
error msg
i seem to have problem with ssl authentication as i ve no problem with non-ssl
source code
Code: Select all
<?php
include 'Net/POP3.php';
$pop3 =& new Net_POP3();
/*
* Connect to localhost on usual port
* If not given, defaults are localhost:110
*/
$pop3->connect('ssl://pop.gmail.com', 995);
/*
* Login using username/password. APOP will
* be tried first if supported, then basic.
*/
$pop3->login('username@gmail.com', 'password', 'USER');
/*
* Get the raw headers of message 1
*/
echo '<h2>getRawHeaders()</h2>';
echo '<pre>' . htmlspecialchars($pop3->getRawHeaders(1)) . '</pre>';
$pop3->disconnect();
?>
error msg
Code: Select all
PEAR_Error Object
(
[error_message_prefix] =>
[mode] => 1
[level] => 1024
Code: Select all
=> 1
[message] => Generic login error
[userinfo] =>
[backtrace] => Array
(
[0] => Array
(
[file] => /opt/coolstack/php5/lib/php/PEAR.php
[line] => 566
[function] => PEAR_Error
[class] => PEAR_Error
[object] => PEAR_Error Object
*RECURSION*
[type] => ->
[args] => Array
(
[0] => Generic login error
[1] => 1
[2] => 1
[3] => 1024
[4] =>
)
)
[1] => Array
(
[file] => /opt/coolstack/php5/lib/php/Net/POP3.php
[line] => 189
[function] => raiseError
[class] => PEAR
[object] => Net_POP3 Object
(
[_maildrop] => Array
(
)
[_timestamp] =>
[_timeout] => 3
[_socket] => Net_Socket Object
(
[fp] =>
[blocking] => 1
[persistent] =>
[addr] => ssl://pop.gmail.com
[port] => 995
[timeout] => 3
[lineLength] => 2048
[_debug] =>
[_default_error_mode] =>
[_default_error_options] =>
[_default_error_handler] =>
[_error_class] => PEAR_Error
[_expected_errors] => Array
(
)
)
[_state] => 1
[_host] => ssl://pop.gmail.com
[_port] => 995
[_debug] =>
[supportedAuthMethods] => Array
(
[1] => APOP
[2] => PLAIN
[3] => LOGIN
[4] => USER
)
[supportedSASLAuthMethods] => Array
(
[0] => DIGEST-MD5
[1] => CRAM-MD5
)
[_capability] =>
)
[type] => ->
[args] => Array
(
[0] => Generic login error
[1] => 1
)
)
[2] => Array
(
[file] => /opt/coolstack/php5/lib/php/Net/POP3.php
[line] => 264
[function] => _raiseError
[class] => Net_POP3
[object] => Net_POP3 Object
(
[_maildrop] => Array
(
)
[_timestamp] =>
[_timeout] => 3
[_socket] => Net_Socket Object
(
[fp] =>
[blocking] => 1
[persistent] =>
[addr] => ssl://pop.gmail.com
[port] => 995
[timeout] => 3
[lineLength] => 2048
[_debug] =>
[_default_error_mode] =>
[_default_error_options] =>
[_default_error_handler] =>
[_error_class] => PEAR_Error
[_expected_errors] => Array
(
)
)
[_state] => 1
[_host] => ssl://pop.gmail.com
[_port] => 995
[_debug] =>
[supportedAuthMethods] => Array
(
[1] => APOP
[2] => PLAIN
[3] => LOGIN
[4] => USER
)
[supportedSASLAuthMethods] => Array
(
[0] => DIGEST-MD5
[1] => CRAM-MD5
)
[_capability] =>
)
[type] => ->
[args] => Array
(
[0] => Generic login error
[1] => 1
)
)
[3] => Array
(
[file] => /export/home/113.php
[line] => 24
[function] => login
[class] => Net_POP3
[object] => Net_POP3 Object
(
[_maildrop] => Array
(
)
[_timestamp] =>
[_timeout] => 3
[_socket] => Net_Socket Object
(
[fp] =>
[blocking] => 1
[persistent] =>
[addr] => ssl://pop.gmail.com
[port] => 995
[timeout] => 3
[lineLength] => 2048
[_debug] =>
[_default_error_mode] =>
[_default_error_options] =>
[_default_error_handler] =>
[_error_class] => PEAR_Error
[_expected_errors] => Array
(
)
)
[_state] => 1
[_host] => ssl://pop.gmail.com
[_port] => 995
[_debug] =>
[supportedAuthMethods] => Array
(
[1] => APOP
[2] => PLAIN
[3] => LOGIN
[4] => USER
)
[supportedSASLAuthMethods] => Array
(
[0] => DIGEST-MD5
[1] => CRAM-MD5
)
[_capability] =>
)
[type] => ->
[args] => Array
(
[0] => username@gmail.com
[1] => password
[2] => USER
)
)
)
[callback] =>
)