|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
perl (conky) and gmail/IMAP unread message count
Hi all, I use Conky monitor (Conky - Home) for my laptop and I needed a script to see the count of new messages on gmail/IMAP, then I made this small perl script (I hope they can be useful to someone )gimap.pl Code:
#!/usr/bin/perl
# gimap.pl by gxmsgx
# description: get the count of unread messages on gmail imap
use strict;
use Mail::IMAPClient;
use IO::Socket::SSL;
my $username = 'example.username'; # example.username@gmail.com
my $password = 'password123';
my $socket = IO::Socket::SSL->new(
PeerAddr => 'imap.gmail.com',
PeerPort => 993,
)
or die "socket(): $@";
my $client = Mail::IMAPClient->new(
Socket => $socket,
User => $username,
Password => $password,
)
or die "new(): $@";
if ($client->IsAuthenticated()) {
my $msgct;
$client->select("INBOX");
$msgct = $client->unseen_count||'0';
print "$msgct\n";
}
$client->logout();on crontab: Code:
* * * * * ~/scripts/gimap.pl > ~/.email/gimap.ct on conky file configuration (~/.conky/conky.conf): Code:
${color1}E-mail: ${color2}gmail ${color1}(imap): ${color3}${execi 20 cat ~/.email/gimap.ct} ${color2}newconky screenshot:
Last edited by gxmsgx; 07-25-2009 at 10:38 AM.. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell script to manipulate a message count for the same IP @ diff session | gobinath | Shell Programming and Scripting | 1 | 05-28-2008 03:13 PM |
| fetchmail imap gmail certificate | c19h28O2 | UNIX for Dummies Questions & Answers | 13 | 03-11-2008 09:45 PM |
| Mark messages as unread | Rylann | UNIX for Dummies Questions & Answers | 1 | 01-24-2005 10:08 AM |
|
|