The following code makes it possible to loop through email addresses saved in the file
#!/bin/bash for i in $(cat /home/maarten/emailaccounts.txt); do zmmailbox -z -m $i getRestURL "//?fmt=tgz" > /backup/$i.$(date +%d-%m-%Y).tgz done
For now the addresses have to be added manually to the file
emailaccounts.txt, but with the
zmprov command it’s possible to generate a list of accounts, which can also be used as a source for accounts that have to be exported.
Make sure you have a folder backup in the root of your server (
mkdir /backup), and it is writable for the Zimbra user (
chown zimbra:zimbra /backup).
A better version of this backup script can be found here.