My own GMail notifier

by brian d foy


I don't use Windows, so I don't get to use GMail Notifier. So I wrote my own. Now that GMail allows POP access, I can just check it that way. No big whoop.




#!/usr/bin/perl
use Mail::POP3Client;

$pop = new Mail::POP3Client(
USER => $ENV{GMAIL_USER},
PASSWORD => $ENV{GMAIL_PASS},
HOST => "smtp.gmail.com",
PORT => 995,
USESSL => 'true',
);

my $count = $pop->Count;
my $plural = $count == 1 ? [ 'is', '' ] : [ 'are', 's' ];

print "$ENV{GMAIL_USER}: There $$plural[0] $count" .
" message$$plural[1]\n";

$pop->Close();

2 Comments

aristotle
2004-11-18 04:42:43
Aesthetic nitpickery
my ( $verb, $plural ) = $count == 1 ? ( 'is', '' ) : ( 'are', 's' );


$count ||= "no";


print "$ENV{GMAIL_USER}: There $verb $count message$plural\n";


I hope it comes out right, because there's still no preview button on the comment form.

Avan
2004-11-21 14:14:58
Use Firefox for Gmail notifier
If you use Firefox for browsing, then you can download a Gmail notifier extension. It shows you how many new Gmail e-mails with a small M letter. Very neat and beautiful, and Firefox runs on every platforms.