Top Nav

Export Zimbra mailbox

To export the mailbox for as a zip file use this command:

/opt/zimbra/bin/zmmailbox -z -m getRestURL \
‘//?fmt=zip&query=is:anywhere’ >

Here is the same as a tgz file:

/opt/zimbra/bin/zmmailbox -z -m getRestURL \
“//?fmt=tgz” > /tmp/account.tgz

And here’s a restore of the tgz file:

/opt/zimbra/bin/zmmailbox -z -m postRestURL \
“//?fmt=tgz&resolve=reset” /tmp/account.tgz

  • Istvan

    have you tried zip restore?
    does it work for you?

  • Xtrenge

    this is for 1 user.. but what about couple (100’s) more is there some script or something like this? thanks 🙂

  • Monk

    Xtrange, if you want to use it for all users simply run this:
    /opt/zimbra/bin/zmprov -l gaa > /opt/zimbra/backup/users.list

    for mbox in `cat /opt/zimbra/backup/users.list` ;
    /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’`.zip

  • Tom Goss

    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?

  • Nibs Niven

    Thanks for the great script Monk, however I needed to alter:
    “/opt/zimbra/backup/domain/$mbox_`date +’%Y%m%d_%H%M%S’`.zip”
    “/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.

  • Lucky

    HI … I would like to knw how to extract mails from zimbra between specific dates, and after extracting how should i view them