I am apparently logging in to my pop3 server OK since there are no errors. But perhaps the error checking is not finding an error in the process given the way I am testing for an error in connect or sign-on. It is hard to tell.
What I am seeing is a problem when I try any POP3 method like numMsg() I am getting nothing back. The email account has messages but it seems I am not seeing anything. I get back no data and no errors and have tried a number of the methods to see if I am seeing anything.
So you are not in the dark, I have attached the code with the obvious sign-in info dummied out so you can see what I am doing.
I would appreciate your help in diagnosing my problem since this is my first foray into using the PEAR libraries and I am "flying a bit in the clouds here."
<?php
// -- TEST HARNESS
session_start();
// OPEN THE CONNECTION TO THE DABASE
//{{{
//}}}
// include class
require_once('Net/POP3.php');
// initialize object
$pop3 = new Net_POP3();
// attempt connection to server
$mailhost = 'asite.com';
$connected = $pop3->connect($mailhost, 110);
if($connected == FALSE){
var_dump($ret instanceof POP3);
$msg = $connected->getDebugInfo ();
$code = $ret->getCode();
$userinfo = $connected->getUserInfo();
echo '<br />Error debugging info: ' . $msg . '<br />
<br />Error Code: ' . $code . '<br />
<br />User Info: ' . $userinfo . '<br />';
}else{
echo '<br />Login to ' . $mailhost . ' was successful<br />';
}
// attempt login
$user = '
[email protected]';
$passwd = 'test';
$ret = $pop3->login($user, $passwd);
if($ret == FALSE){
echo '<br />LOGIN FAILED.';
var_dump($ret instanceof POP3);
$msg = $ret->getDebugInfo ();
$code = $ret->getCode();
$userinfo = $ret->getUserInfo();
echo '<br />Connection Failed. Error: ' . $msg . ' error code: ' . $code . ' userinfo: ' . $userinfo . '<br />';
die($pop3->error);
}
echo '<br />sign in as ' . $user . 'was successful<br />';
// FIND OUT HOW MANY EMAILS THERE ARE
$numbermsgs = $pop3->numMsg();
if($numbermsgs == FALSE){echo '<br />ERROR in Number Messages<br />';
exit();
}
// print number of messages found
if($numbermsgs <= 0){$numbermsgs = 'no';}
echo '<br /> There are ' . $numbermsgs . ' message(s) in mailbox<br />';
// print message headers
if ($pop3->numMsg() > 0) {
for ($x=1; $x<=$pop3->numMsg(); $x++) {
$hdrs = $pop3->getParsedHeaders($x);
echo $hdrs['From'] . "\n" . $hdrs['Subject'] . "\n\n";
}
} // disconnect from server
$pop3->disconnect();
?>