Created
February 21, 2011 08:51
-
-
Save alexm/836824 to your computer and use it in GitHub Desktop.
find all imap folders and print total and new number of messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $SERVER = 'imap.example.com'; | |
my $USER = 'user.name@example.com'; | |
my $PASSWD = '***'; | |
my $PORT = 993; | |
my $SSL = 1; | |
use Mail::IMAPClient qw(); | |
my $imap = Mail::IMAPClient->new( | |
Server => $SERVER, | |
User => $USER, | |
Password => $PASSWD, | |
Port => $PORT, | |
Ssl => $SSL, | |
); | |
for my $f ( $imap->folders ) { | |
my $total = $imap->message_count($f); | |
next unless defined $total; | |
my $new = $imap->unseen_count($f); | |
print "$f: $total total, $new new\n"; | |
} | |
$imap->logout; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment