Debido a que mi madre no revisa su correo seguido. una forma visual fue activar el ebuddy
el codigo lo encontre en el foro de ubuntu! solo fue adaptado un poco
#!/usr/bin/perl
use Mail::IMAPClient;
use IO::Socket::SSL;
use Date::Parse;
use IO::Socket;
use strict;
my $num = 10;
my $sock = IO::Socket::INET->new(
Proto => 'udp',
PeerPort => 8888,
PeerAddr => '127.0.0.1',
) or die "Could not create socket: $!\n";
my $output_file = '/home/patricio/.gmail_unread';
my $max = $ARGV[0];
my $imap = Mail::IMAPClient->new
( User => 'gnu@gmail.com',
Password => 'elseb2eswk',
Socket => IO::Socket::SSL->new
( Proto => 'tcp',
PeerAddr => 'imap.gmail.com',
PeerPort => 993, # IMAP over SSL standard port
),
);
$imap->select('Inbox');
my @unread = $imap->unseen or warn "Could not find unseen msgs: $@\n";
$sock->send('25') or die "Send error: $!\n";
unless (scalar(@unread))
{
unlink $output_file;
exit;
}
my(@lines);
my $count = 0;
foreach my $msg_id (@unread)
{
$count++;
if ($count > $max)
{
push(@lines,"More...\n");
last;
}
my $date = convert_time($imap->get_header($msg_id, "Date"));
my $from = $imap->get_header($msg_id, "From");
my $subject = $imap->get_header($msg_id, "Subject");
push(@lines, "$from - $date\n $subject\n");
}
open(OUT,">$output_file");
print OUT (@lines);
close(OUT);
$sock->send('18') or die "Send error: $!\n";
sub convert_time
{
my $old_time = str2time(shift);
my $seconds = time() - $old_time;
my $time_string;
if (int($seconds / 3600))
{
$time_string .= (int($seconds / 3600).'h');
$seconds = $seconds = int($seconds / 3600);
}
if (int($seconds / 60))
{
$time_string .= (int($seconds / 60).'m');
$seconds = $seconds = int($seconds / 60);
}
if ($seconds)
{
$time_string .= ($seconds.'s');
}
return "$time_string ago";
}