Fellow monks,

Is there a trick to get Net::POP3 to check multiple mailboxes on a server for the purpose of determining the number of pending messages? I've tried the following code and it works fine for the first user, but subsequent users come up with no mail, when I know there is mail there. Setting it up with a single user login/pw it works like a champ, but I'd like a way to just do a simple check every now and again to see if it's piling up.

The reason I'm doing this is that I've got a user on the system who is complaining of e-mail retrieval being slow and I want something to physically show them why it is so slow and going to get worse if they don't clean out their mailbox. Fortunately it's only affecting the one user, not everyone.

use strict; use Net::POP3; $|++; my %user = ( a => 1 , b => 2, c => 3); my $host = "host.net"; my $pop = Net::POP3->new($host); for my $key ( keys %user){ print "Working on $key...\n"; my $msg = $pop->login( $key, $user{$key} ); print "$key: $msg\n"; $pop->quit; }

I've tried using a sleep(15) after the $pop->quit so that the server had time to reset, but that didn't work either.

Can anybody shed light on why this behaves the way it does, or is that the expected behavior?

Revolution. Today, 3 O'Clock. Meet behind the monkey bars.

I would love to change the world, but they won't give me the source code


In reply to Checking muliptle mailboxes on same server with Net::POP3 by Popcorn Dave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.