https://wiki.zimbra.com/wiki/Get_all_user's_mailbox_size_from_CLI
su - zimbra all_accounts=`zmprov -l gaa`; for account in $all_accounts; do mbox_size=`zmmailbox -z -m $account gms`; echo "Mailbox size of $account = $mbox_size"; done ;
I was searching for a CLI method of applying a GUI attribute but could find no documentation. I looked at the zmprov help options and found the option of description!
This will give all attributes changeable via zmprov
zmprov description
Then find a term you think might be relevant and grep for it (here I though “Address” might be part of the attribute name)
zmprov description | grep Address
zmprov -l gaa
zmprov -l gaa somedomain.com
zmprov -l gaa | grep -v mail.somedomain.com | grep -v galsync
This reply's based on the user's email address being in the to,cc fields…
/opt/zimbra/bin/zmmailbox -z -m account@domain.com afrl "Filter_name" active any address "to,cc" all is "alias@domain.com" reply "Auto reply message" stop
This reply is based on anything that arrives after a certain date, effectively replying to everything after that date.
/opt/zimbra/bin/zmmailbox -z -m mcl@porschefresno.com afrl "Auto_Reply_To_All" active any date after 20190501 reply "Please note that the mailboxes user@domain.com and useralias@domain.com are no longer in use." stop
http://shahzadlinux.blogspot.com/2017/01/how-to-take-mailbox-backup-of-zimbra.html
This is useful for individual backups or archiving a mailbox that is no longer needed and will be deleted.
zmmailbox -z -m user@example.com getRestURL "//?fmt=tgz" > /backup/user@example.com.tar.gz
zmmailbox -z -m user@example.com postRestURL "//?fmt=tgz&resolve=reset" /backup/user@example.com.tar.gz
zmmailbox -z -m user@example.com postRestURL "/archive_2021/?fmt=tgz&resolve=reset" /backup/user@example.com.tar.gz
#Python Script that uses Shell Scripts to Export Mailboxes from Zimbra #Requires Python 3.5 or higher #Must be run as zimbra user #No error checking, and is rough but works... # https://stackoverflow.com/questions/4256107/running-bash-commands-in-python # Import subprocess to allow OS/bash commands import subprocess import datetime # The file path and file that contains the mailboxes to be exported # The file should contain 1 E-mail address per line mailboxes_to_export_fp = "/opt/zimbra/scripts/mailbox_export/mailboxes_to_export.txt" # The file path where the mailboxes will be exported to export_fp = "/tmp" # Open file and read it line by line: https://stackabuse.com/read-a-file-line-by-line-in-python/ with open(mailboxes_to_export_fp) as fp: for index, line in enumerate(fp): line = ("{}".format(line.strip())) mailbox = line ct = datetime.datetime.now() print(line) print(mailbox) # Run a bash command in Python with a Python variable: https://stackoverflow.com/questions/29834114/use-python-variable-in-bash-command-with-os-system https://www.reddit.com/r/learnpython/comments/18q69d/how_can_you_pass_a_command_with_quotes_to_the/ bashCommand = ("zmmailbox -z -m {mailbox} getRestURL \"//?fmt=tgz\" > \"{export_fp}/{mailbox}_{ct}.tar.gz\"".format( mailbox=(mailbox), ct=(ct), export_fp=(export_fp))) print(bashCommand) subprocess.call(bashCommand, shell=True) # having to use shell=True since it needs to run in the Zimbra users environment # import shlex # subprocess.call(shlex.split(bashCommand))