jueves, noviembre 18, 2004

My own GMail notifier

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();"

This page is powered by Blogger. Isn't yours?