Finaly,
After a lot of work, here it is:
https://docs.google.com/open?id=0B5j...XBIY1J1Q0p4UFk
Alternate location:
Open Upload - File download
I have tested it wit gmail and imported back to zimbra. Some flags are awkward on gmail but I check all of them from script.
I am dumping all the messages in a shelve object with the key made of md5 from message header and folder. (you will not have duplicates).
Import is done using threads as max as batch_size, as python imap allows only one message at a time (which is very slow).
Use case example
dump gmail
gmail uses login over ssl so this should work:
/home/eguloiu/python-imap-util.py -i imap.gmail.com -u
user@gmail.com -a
user@gmail.com -p 'secret pass' -t 993 -s -b -l
import into zimbra:
/home/eguloiu/python-imap-util.py -i <zimbra ip or name> -u user@domain -a admin@domain -p <admin pass> -t 993 -s -r -f <backup file generated>
See help for more options, or take a look into the scritp.
I need your feedback and anyone's who uses the script.
This is some output from my zimbra server:
------Backup start time 2012-09-20 18:57:58.012247
['"Chats"', '"Contacts"', '"Drafts"', '"INBOX"', '"INBOX/Drafts"', '"INBOX/Sent"', '"INBOX/Spam"', '"Junk"', '"Sent"']
Selected folder: "Chats"
Selected folder: "Contacts"
Selected folder: "Drafts"
Selected folder: "INBOX"
Writting message 75993 of 75993
Selected folder: "INBOX/Drafts"
Selected folder: "INBOX/Sent"
Selected folder: "INBOX/Spam"
Selected folder: "Junk"
Writting message 155 of 155
Selected folder: "Sent"
------Backup end time: 2012-09-20 19:03:49.420811, Duration: 0:05:51.408580
I will really appreciate any feedback.
Thanks