Presenting my first decent perl script, kcheckmail.pl. Its a mail biff, specially for KDE.
Why another biff, you ask? Well, I had to write something, and this gave me the opportunity to learn about CPAN mods, and a lot of perl magic in one go. Secondly, I get a hell lot of email at work. So I have always wanted a biff, that displayed the ‘from’ address and the ‘subject’ line of the email in a popup window, but never found one. That was a good incentive.
Kcheckmail depends on the following perl modules:
KDE (the kdialog utility?)
In the next realease, I intend to make the IO::Socket::SSL optional, i.e., needed only if you intend to use IMAP over SSL. But for now, it is a requirement.
kcheckmail reads its config from either a file, or a command line. A sample config file is bundled for your reference. It runs in either of 2 modes, display or biff. In display moode, kcheckmail simply connects to your imap server, andd tells you the total number of messages in the INBOX, and any new / unseen messages. If running in biff mode, it forks itself into the background, and displays a popup window (using ‘kdialog’) with the sender’s address and the subject for each new email. If the password is not in the config file (good idea), it prompts you for a password (again using kdialog).
Of course, the wonderful mail::IMAPClient perl module does half of the job. But credits also go to the other modules used out there.
Getting mail::IMAPClient to play nicely with SSL was possible mainly due to the hard work of Nick Burch and Ganesh Sittampalam in Nick’s demo code. His demo code can be found here.
If too many new messages come together, kdialog would keep popping windows, although one after another, with kcheckmail itself not doing any work during this time. This needs to be altered to a more “pine-like” behaviour, which will only display the most recent unseen message’s details, for example:
4 new mails. Most recent from
Hopefully will get it in the next version.