KMail Power Tools 0.3
KMail Power Tools is meant to be a suite of enhancements to KMail and may be other mail user agents.
It is currently composed of only one (perl) script that acts as a filter (take input from stdin, outputs the modified mail to stdout), adds dialog boxes to kmail, and allows the user to:
· remove all attachments from an email (no user interaction),
· remove selectively attachments, after asking the user,
detach (i.e. save then remove) any attachment to a directory chosen by the user,
· hence reducing the size of your mailbox, while allowing you to backup important attached files.
All these actions are logged within a sentence in the mail body (see below).
Note: removing and detaching is already supported by Thunderbird, but my favourite mailer program is KMail, then...
How it works
KMail allows the definition of filters (like any other email program), but you can define filters:
· which are launched manually,
· which can be programs reading your email on stdin and outputing the result on stdout (or "pipe through").
So I had the idea to use this in order to enhance KMail, and allow it to remove and detach attachments: kmailpt will read and interpret the email (thank you Perl MIME::Parser), then depending on the command line switches, popup a dialog box to ask the user for a directory where to save attachments, and ask him which attachment to remove/detach (thank you Kdialog!).
Also, the sentence "[Attachment removed by jice (26/02/2007 20:33:01): bill.zip]" will be added to the mail body. When you detach an email, it will add a similar sentence, and if the mail body is html, you will even get a link to the new location of the file: "[Attachment saved by jice (26/02/2007 20:36:17) to heavenly.gif]", on which you can even click in order to view the detached file. For text/plain messages, the sentence will be something like: "[Attachment saved by jice (26/02/2007 20:36:17) to file:///home/jice/Images/heavenly.gif]" (unfortunately, although kmail renders http:// or ftp:// urls as links, file:// are not (yet?) - I should enter a bug on bugs.kde.org for this...).
Should you want to know the currently available command line switches, here is the help:
Usage: kmailpt [options]
kmailpt takes an email on stdin, performs actions based
on this mail, then output an email on stdout.
Without any option, it will remove any file attached.
-d detach the attachments (save and remove)
-q ask which attachment to remove
-h prints this help
What's New in This Release:
· New icons thanks to Rüdiger Härtel
· Handle gpg encrypted emails: - Now able to remove/detach attachments within a gpg encrypted email
- New command line option -g to tell kmailpt to leave the resulting email decrypted
- Command line option -p tells KmailPT to use gpg-agent instead of asking the passphrase option -d now takes an optional argument to tell it from the command line where to store the detached files.
· When this argument is present, every file is detached to the given destination.
· The disclaimer was added even to text/plain and text/html attached files. This is fixed.