Skip to content

Instantly share code, notes, and snippets.

@0x00dec0de
Forked from filippo/zimbra-backup-emails.sh
Created January 12, 2024 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0x00dec0de/ee2de08026b1bc953c3ca59ba4c939d6 to your computer and use it in GitHub Desktop.
Save 0x00dec0de/ee2de08026b1bc953c3ca59ba4c939d6 to your computer and use it in GitHub Desktop.
How to backup and restore emails of a specific account on zimbra
# The command below creates a tgz file with all emails for user@domain.com in .eml format:
# execute as root
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "//?fmt=tgz" > /tmp/account.tgz
# You can do the same via a REST URL:
wget http://ZIMBRA.SERVER/home/user@domain.com/?fmt=tgz
# to restore email:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com postRestURL "//?fmt=tgz&resolve=reset" /tmp/account.tgz
# The resolve= parameter has several options:
# - skip: ignores duplicates of old items, it’s also the default conflict-resolution.
# - modify: changes old items.
# - reset: will delete the old subfolder (or entire mailbox if /).
# - replace: will delete and re-enter them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment