How to remove attachments from kmail

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
fudgy
Posts: 86
Joined: Wed 07 Jun 2006, 09:40
Location: Berlin, Germany

How to remove attachments from kmail

#1 Post by fudgy »

...yust set up a filter with the action 'pipe through' and the command:

egrep -v ^.[A-Za-z0-9=/+]{68}.*$

Thats it. Be shure to set the filter to 'manual' as this deletes data.
Have fun!

fudgy

ps.
please tell me if i forgot to include characters in the RegEx. This RegEx simply looks for strings with no spaces for a length of 68 characters minimum in one line. If these are found, they are excluded (-v option). The output is passed back to kmail - replacing the original message.

pps. The attachment will be 'visible' to kmail (with 2 bits length) so you know the name it had. You can use the %1, %2 etc. command to save attachments before deleting, like so (filter action 'execute command'):
cp %1 /initrd/mnt/dev_save/attach/`date --iso-8601 +%F-%H%S`-001

...but unfortunately one loses the name of the original attachment. So I prefer saving by hand before stripping it off my email folder.

Post Reply