KMail Power Tools

[fr] désolé mais je manque de temps pour traduire cette page en français.

What is it?

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:

hence reducing the size of your mailbox, while allowing you to backup important attached files.

All these actions are logged within a sentence (called "disclaimer") in the mail body. Plus when you detach a file, you don't lose the link between your email and the file! (see below).

Note 1: kmailpt is also able to remove/detach attachments from gpg encrypted emails, and to store these emails decrypted.

Note 2: 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:

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):]" 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:// urls are not (yet?) made clickable - please vote for bug 60265 on

Should you want to know the currently available command line switches, here is the help:

KMail power tools 0.3
(c) 2007 Jean-Christophe Cardot <kmailpt <at>>
This program is distributed under the terms of the GPL licence
Usage: kmailpt [action] [options]

kmailpt takes an email on stdin, performs actions based
on this mail, then output the resulting email on stdout.

Actions: (one among these options is mandatory)
        -a       remove all attachments (no user interaction)
        -q       ask which attachment to remove
        -d [dir] detach the attachments (save and remove).
                 When given the optional argument directory,
                 detaches all the attachments to this directory
(new optional argument)
                 (no user interaction)
        -g       decrypt gpg emails (to store them decrypted)
(new option)
        -m       add the detached/removed file md5 to the message
        -s       add the detached/removed file size to the message
        -n       multiline disclaimer
        -p       use gpg-agent (don't ask for gpg passphrase)
(new option)
        -h       prints this help


The icons in the toolbar
The new icons in the toolbar (attachment save icon & attachment delete icon), along with the result (see the mail body) of a removed file (get rid from those *$&# smileys from Incredim4il ;-)

KMailPT asking where to store the detached files
KMailPT asking where to store the detached files

KMailPT asking which attachment to remove
KMailPT asking which attachment to remove or detach

The result of a detached file, within the mail body
The result of a detached file, within the mail body (see in the status bar the hyperlink to the new location of the file; you can click on the link to view the file.)

How to install

  1. Pre-requisites: Perl packages MIME::Parser, MIME::WordDecoder & GnuPG::Interface (new optional requirement since 0.3), Kdialog
    Note: in Mandriva, MIME::Parser resides in the 'perl-MIME-tools' package, whereas in Debian based distros, it can be found in the 'libmime-perl' package.
  2. Uncompress the tarball in a temporary directory.
  3. Install the files system wide by: make install (as root). This will copy to /usr/local/bin, and the icons to /usr/share/icons/.
  4. You may repeat 4 times this step:

How to upgrade

  1. If you already had installed the version 0.1 or 0.2, then you just need to unpack the archive, then type (as root) make install (this will simply copy to /usr/local/bin)
  2. If you created a "Remove all attachments" filter and upgrade from version 0.1, then add the -a option to the command line, else it will do nothing.

How to use

Just select the email in KMail, then call the appropriate filter, with the new icon in the toolbar, the contextual menu, or the keyboard shortcut.



To do


© Jean-Christophe Cardot <jice chez cardot point net> 2007