Some [joker](http://yulian.firdaus.or.id) has been sending attachments in antiquated [UUencode](http://en.wikipedia.org/wiki/Uuencode) format :). Since my email client [KMail](http://kmail.kde.org) does not support UUencode, I had to find some way to convert UUencoded files into proper [MIME](http://en.wikipedia.org/wiki/MIME) attachment.
After trying several ideas I’ve found on the Net, the best way to accomplish this is by using [uu2mime](http://dev.gentoo.org/~agriffis/uu2mime/), a [Ruby](http://www.ruby-lang.org) script which takes an [RFC2822](http://www.ietf.org/rfc/rfc2822.txt) message as its input, converts any UUencoded files it finds, and outputs them as proper MIME attachment while preserving the content of email.
To use uu2mime with KMail, I took the following steps:
1. Put the uu2mime script somewhere and make it executable.
2. Install ruby and rubymail library (under [Gentoo](http://www.gentoo.org), a simple ’emerge ruby rubymail’ will do the job).
3. Create a new filter in KMail (Settings, Configure Filters, and click ‘New’ button).
4. In filter criteria, specify ‘body’ ‘contains’ ‘begin 644’.
5. In filter actions, use ‘Pipe through’ and specify the full path of the uu2mime script
6. Uncheck ‘If the filter matches, stop processing here’.
7. Put the rule as the topmost rule.
8. Save the filter.