[Users] Migrate to new installation, extract attachments

Felipe T. Dorado ftdorado at ono.com
Fri Jul 22 23:24:57 CEST 2016


Hello  : )

I've successfully migrated my mail and ClawsMail configs to a new
installation of Debian Linux 7.8. 
I have done this before and it has worked perfectly. The way to do it is
simple:

	- install clawsmail anew, with apt-get, Synaptic or whatever you
	  use.
	- copy  old /home/user/.clawsmail to the new /home/user
	- copy the whole old /Mail to the new /home/user directory.

And that's it. I have my new clawsmail working as usual : )  Great!

Is that _the_ way to do it or is there a better way?


Now, I wanted to extract the attachments received, to archive 
externally and save that on good old Sylpheed/ClawsMail.
I found the script [1] Holger Berndt sent to this list on Apr 20 2013 [2]
and tried it. 

I told it to:

$ ./extract_attachments_from_claws.py --all-content-types
--recursive /home/philip/Mail /home/philip/Mail/attaches 

It works well on some folders although not an the main Mail folder. Like
Philippe Gramoullé says on Tue Apr 23 2013 [3] I also get more or less the
same errors:

Traceback (most recent call last):
  File "./extract_attachments_from_claws.py", line 170, in <module>
    sys.exit(main())
  File "./extract_attachments_from_claws.py", line 166, in main
    extract_attachments(args.mime_filename, args.target_directory[0],
args.content_type, args.subfolder_by_sender, args.recursive)
  File "./extract_attachments_from_claws.py", line 125, in
extract_attachments
    mime_file.extract(target_dir, patterns)
  File "./extract_attachments_from_claws.py", line 70, in extract
    os.makedirs(target_directory)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Licor'

That last error is about one of the folders which I have checked has the
same owner and permissions of the rest of them under Mail. That is I am the
owner, the individual files have rw and all the subfolders have permissions
drwxr-xr-x 16 philip philip  4096 feb 22 10:56 Licor.

If my command is:

$ ./extract_attachments_from_claws.py --all-content-types
--recursive /home/philip/Mail/Entrada /home/philip/Mail/attaches/Entrada

Then it creates the folder Entrada although the errors are the same but for
the last two:
 
   File "./extract_attachments_from_claws.py", line 102, in extract
   fp.write(part.get_payload(decode=True))  
TypeError: must be string or buffer, not None

I'm afraid I'm not able to figure out what wrong in this case so I ask for
help in finding out what gives. I would like to run this script once a
month, for instance, to alleviate the weight of the Mail folder.

Thank you Holger, thank you Philippe, thank you All.

Felipe  : )


[1] URL: http://lists.claws-mail.org/pipermail/users/attachments/20130420/0248a802/attachment.py
[2] http://claws-mail.org/pipermail/users/2013-April/006036.html
[3] http://claws-mail.org/pipermail/users/2013-April/006044.html





More information about the Users mailing list