I'm having difficulty getting this code of Discipulus' to work--actually, I think his code is fine and wonder about my dovecot instance--and have stripped things down to a test case:
#!/usr/bin/perl use strict; use warnings; use Mail::IMAPClient; my $now = time; print "Now is $now\n"; (my $username, my $password) = ('re','dacted'); my $imap = Mail::IMAPClient->new(Server => 'localhost', User => $username, Password => $password, Port => '143'); die "failed to instantiate $@." unless defined $imap; my $select = $imap->select('INBOX'); my @messages = $imap->messages('INBOX'); print "All @messages\n"; sleep 15; #<---Here's where I generate fresh mail, during the sleep $select = $imap->select('INBOX'); @messages = $imap->sentsince($now); print "Some @messages\n"; print "Now then was $now\n"; $now = time; print "Now now is $now\n";
Which gives me these results:
Now is 1752071233 All 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3 +456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 Some Now then was 1752071233 Now now is 1752071248
What I expect is for the new mail to show up in the Some line, but it does not.
They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen

In reply to Re: Read and manage IMAP mails for me by adamsj
in thread Read and manage IMAP mails for me by Discipulus

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.