Skip to content

Instantly share code, notes, and snippets.

@bradclawsie
Created December 5, 2010 06:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradclawsie/728873 to your computer and use it in GitHub Desktop.
Save bradclawsie/728873 to your computer and use it in GitHub Desktop.
imap biff in perl
#!/usr/bin/env perl
use Net::IMAP::Simple::SSL;
$| = 1;
my $server = 'imap.gmail.com';
my $user = 'YOU@gmail.com';
my $pass = 'PASSWORD';
my $imap = Net::IMAP::Simple::SSL->new($server);
$imap->login($user => $pass) || die "cannot connect";
my $messages = $imap->select('Inbox');
my $count = 0;
for my $msg (1..$messages) {
$count++ unless $imap->seen($msg);
}
$imap->quit();
print $count . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment