[Users] Save all attachments from all emails

Holger Berndt berndth at gmx.de
Sat Apr 20 20:59:16 CEST 2013


Hello Philippe,

On Sa, 20.04.2013 00:37, Philippe Gramoullé wrote:

>Well, since i have so many years worth of email, i'd like to extract all attachments
>of all emails in a single folder so i can more easily browse through pictures, PDFs, videos, etc..
>
>Basically, i'd like to use the same feature as "Save all attachments" but for all emails inside a folder
>
>What would be the easiest way ? Perl/Python script using the Perl/Python plugins ?

I think it would probably be easiest to do it from outside Claws Mail.
Claws Mail's default storage format MH is quite easy to parse for
other tools.

I attached a script that I use as a filter to store pictures of some
incomming mails automatically to a folder - but it should also be able
to do what you want, e.g.

store all attachments of a mail folder tree

  extract_attachments_from_mime_message.py --all-content-types --recursive /path/to/mail/folder /path/to/target/folder

You can also select which attachments to store based on MIME type,
e.g. only image/* and application/pdf:
  
  extract_attachments_from_mime_message.py --content-type image --content-type application/pdf --recursive /path/to/mail/folder /path/to/target/folder

Maybe it helps. Beware that these are not very well tested (because I 
use the script differently) - no guarantees.

You can also check out --help.

Holger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extract_attachments_from_mime_message.py
Type: text/x-python
Size: 7228 bytes
Desc: not available
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20130420/0248a802/attachment.py>


More information about the Users mailing list