To export the mailbox for user@acme.com as a zip file use this command:
/opt/zimbra/bin/zmmailbox -z -m user@acme.com getRestURL \
‘//?fmt=zip&query=is:anywhere’ > user_at_acme_com.zip
Here is the same as a tgz file:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL \
“//?fmt=tgz” > /tmp/account.tgz
And here’s a restore of the tgz file:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com postRestURL \
“//?fmt=tgz&resolve=reset” /tmp/account.tgz





11 Responses
Ok, it works perfectly!
Thanks!
HI
looks very interesting!
bookmarked your blog.
john brightman
Thankiossk Cool!
Thankiossk Cool!
Thankiossk Cool!
have you tried zip restore?
does it work for you?
this is for 1 user.. but what about couple (100’s) more is there some script or something like this? thanks 🙂
Xtrange, if you want to use it for all users simply run this:
/opt/zimbra/bin/zmprov -l gaa domain.org > /opt/zimbra/backup/users.list
for mbox in
cat /opt/zimbra/backup/users.list;do
/opt/zimbra/bin/zmmailbox -z -m $mbox getRestURL ‘//?fmt=zip&query=is:anywhere’ > /opt/zimbra/backup/domain/$mbox_
date +'%Y%m%d_%H%M%S'.zipdone
Where do you input this command? I’m trying to export my emails from Zimbra and re-import them to gmail with my folders in tact. Any way to do this?
Thanks for the great script Monk, however I needed to alter:
“/opt/zimbra/backup/domain/$mbox_
date +'%Y%m%d_%H%M%S'.zip”to
“/opt/zimbra/backup/${mbox}_
date +'%Y%m%d_%H%M%S'.zip”otherwise it would not name the files with the mbox name, and I had no subdir of backup called domain.
HI … I would like to knw how to extract mails from zimbra between specific dates, and after extracting how should i view them