KZ has asked for the wisdom of the Perl Monks concerning the following question:

the problem that i am facing is that i cant get all the messages from my POP3 folder, if the no. of messages is small then i get all the messages but as it exceeds 20(or something around it) i only get the last few messages, i m using Mail::Box module and am using the following code
my $mgr = new Mail::Box::Manager; my $pop = $mgr->open(type => 'pop3',folder => '/' ,username => $userna +me, password => $password ,server_name => $serveraddress ,server_port + => $serverport, access => 'rw' ) or die("Cant open account"); my $count = scalar $pop->messages; print $count;
now, if i have 25 messages then only 2 or 3 messages are returned and it appears as if the manager cant see the first few messages

Replies are listed 'Best First'.
Re: getting list of all POP3 messages
by neuroball (Pilgrim) on Jan 26, 2004 at 07:22 UTC

    It seems that you are accessing a Mail::Box::Mbox method from a Mail::Box::Manager object.

    You might want to try to replace $pop->messages with $pop->message.

    Once you did this you might get the right number of messages returned.

    /oliver/

      i dont think this is the problem because $pop->message is used to get a particular message and $pop->messages returns a list of all the messages,and it does, but only for a limited no. of messages, after which it returns only the last few messages of the mailbox, as if some sort of paging has been implemented and it gets the messages of only the last page.

        There certainly is no difference between the message's on MailBox's side. All messages are treated equal (and none is more equal than the other)

        You may add some print statements to Mail::Transport::POP3 sub send() to trace the communication.

        Or try a different POP3 client (mozilla?) to list the messages: do other POP3 implementations show the correct result? This to see on which side (client or server) the bug is.

Re: getting list of all POP3 messages
by Anonymous Monk on Jan 26, 2004 at 09:12 UTC
    now, if i have 25 messages then only 2 or 3 messages are returned and it appears as if the manager cant see the first few messages

    The manager is not the one who is checking the messages: the $pop is a Mail::Box::POP3 object. This is a problem which has not been reported to the Mail::Box mailinglist, and therefore there may be some configuration issue at stake... there may also be a server problem.

    One cause comes in mind. If the folder on the server is an mbox folder, the messages are separated by lines starting with 'From '. These lines show some differences between implementations. It may be possible that your user client recognizes more separators than your pop server does. Have a look at the pop3 logs on the server...

Re: getting list of all POP3 messages
by zentara (Cardinal) on Jan 26, 2004 at 20:53 UTC
    Well just in case you can't get Mail::Box::Manager going, here is something that works.
    #!/usr/bin/perl use Mail::POP3Client; $pop = new Mail::POP3Client( USER => "zentara", PASSWORD => "bigsecret", HOST => "mail.whereever.com" ); for( $i = 1; $i <= $pop->Count(); $i++ ) { foreach( $pop->Head( $i ) ) { /^(From|Subject):\s+/i && print $_, "\n"; } } $pop->Close();
      well, there is some problem. i have used 3 modules i.e Net::POP3 , Mail::Box::POP3 and Mail::POP3Client and all of them return the same no. of messages( that is not correct,not all messages are counted). i have no idea as to what the problem is, may be its gotta do something with the management of mails on our server, but i really need a solution to this problem plz help
      well, there is some problem. i have used 3 modules i.e
      Net::POP3 ,
      Mail::Box::POP3
      Mail::POP3Client
      and all of them return the same no. of messages( that is not correct,not all messages are counted). i have no idea as to what the problem is, may be its gotta do something with the management of mails on our server, but i really need a solution to this problem
      plz help