Export Zimbra mailbox

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

Have a project or a problem?

Talk with a senior engineer for practical recommendations—no obligation.

Leave a comment

11 Responses

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

  2. 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'.zip
    done

  3. 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?

  4. 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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.