PHP Classes

Getting no information after login

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  Getting no information after login  >  (Un) Subscribe thread alerts  
Subject:Getting no information after login
Summary:No errors on connect or login but POP3 functions return no data
Messages:5
Author:james dekle
Date:2008-04-30 16:09:11
Update:2008-05-01 20:07:10
 

  1. Getting no information after login   Reply   Report abuse  
Picture of james dekle james dekle - 2008-04-30 16:09:12
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();


?>

  2. Re: Getting no information after login   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-04-30 21:38:14 - In reply to message 1 from james dekle
This class has nothing to do with PEAR POP3 class.

To use this class you need to download it from:

phpclasses.org/pop3class

  3. Re: Getting no information after login   Reply   Report abuse  
Picture of james dekle james dekle - 2008-05-01 13:25:04 - In reply to message 2 from Manuel Lemos
Thanks, this is confusing since it isn't obviously the PEAR POP3 Class.

I believe this actually is the PEAR Library, it's just how you have to hook up to it with Hostgator.com's implementation. Or at least it is how they instructed me to access the PEAR Library on their servers.

Just to be sure, I downloaded the POP3 PEAR class and copied it directly into my code so I know what is being used.

I figured out the coding to turn on logging so I know a good bit more and the login fails with the password "PASS password" stage. I know the password works since I use it in a web client but am mystified as to why the server does not recognize it. Is it possible this is related to encryption of the password? It's about the only think I can think of right now.

Any ideas are appreciated.

Regards,
J. Dekle


  4. Re: Getting no information after login   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-05-01 15:54:55 - In reply to message 3 from james dekle
I don't know because I do not use PEAR libraries.

Maybe your server requires a special type of authentication that is not supported by PEAR POP3 class.

Anyway, this other POP3 class supports many types of authentications using the SASL client authentication library support.

You may want to try downloading both packages and try them to see if that is the problem:

phpclasses.org/pop3class

phpclasses.org/sasl

  5. Re: Getting no information after login   Reply   Report abuse  
Picture of james dekle james dekle - 2008-05-01 20:07:10 - In reply to message 4 from Manuel Lemos
Thank you for your help and giving me an alternative or two to try.

It is a real puzzler and of course, the POP mail administrator isn't very responsive ... so far. You have been and you have my thanks for helping others with their problems. If I ever get to the bottom of the issue, I will update the thread so others with the problem may find an answer.

Best regards,
J Dekle