467,179 Members | 1,179 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,179 developers. It's quick & easy.

Retrieve mails from mailserver

Hi everybody,

Iam struggling for retrieve mails from mail server using perl
iam facing some problem in blow my code
even i have the mails in my mailserver iam not getting the count of mails
only iam getting count as -1
what was the problem can any body reply back

look at my code
Expand|Select|Wrap|Line Numbers
  1. $pop = new Mail::POP3Client(USER => $username,PASSWORD => $passwd, HOST=> $host,PORT=> $port,TIMEOUT =>20,AUTH_MODE => 'BEST',DEBUG => 1) ||  die "cannot establish connection with the pop3 mail server $host, $!";
  2. print "Connection  established";
  3. print $pop->Count();
  4. print "<table align=center>";
  5. for ($i=1; $i<=$pop->Count(); $i++)
  6. {
  7.     foreach ( $pop->Retrieve( $i ) )
  8.     {
  9.         print "<tr><td>$_</td></tr>\n";
  10.     }
  11. }
  12. print "</table>";

thanking you.

shiva krishna
Jul 2 '08 #1
  • viewed: 1168
1 Reply
Expert Mod 2GB
In looking at the page on CPAN for Mail::POP3Client , I found the following line:

Expand|Select|Wrap|Line Numbers
  1. new returns a valid Mail::POP3Client object in all cases. To test for a connection failure, you will need to check the number of messages: -1 indicates a connection error.
The -1 that you are getting is saying that there is a problem with the connection. I would check and make sure that you can login with the ID/Password you are specifying. Also, I would ensure that the mail system you are connecting to supports POP3.


Jul 11 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Alexander Franksmann | last post: by
3 posts views Thread by mihir | last post: by
3 posts views Thread by Richard Thornley | last post: by
3 posts views Thread by mark.macumber@gmail.com | last post: by
4 posts views Thread by stefano.troiani@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.