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.

*Screenshot*

kcheckmail

*Requirements*

Kcheckmail depends on the following perl modules:

  1. Mail::IMAPClient

  2. AppConfig

  3. Aarray::Comparre

  4. IO::Socket::SSL

  5. 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.

*Logic*

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).

*Credits*

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.

*Download*

Current release:

kcheckmail-0.2

kcheckmail-0.1

*Caveats*

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 titled

Hopefully will get it in the next version.