A way to get an emailable report of all mailboxes in a domain, their quota, usage and account status, so a domain admin can review their accounts without having to login to zimbra. (most of this is the same as viewing quota usage in zimbra admin, but this was easier, as it can then be emailed on a schedule)
Run following command as zimbra user to check all user’s mailbox size:
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 ;
After running above commands you will get output in the below format:
Mailbox size of [email protected] = 5.72 KB Mailbox size of [email protected] = 1.38 KB Mailbox size of [email protected] = 0 B Mailbox size of [email protected] = 19.27 MB Mailbox size of [email protected] = 162.15 KB
or you can using simple bash script like this below
I saved this file in as usagereport.sh
, owned by zimbra.zimbra
and dont forget to chmod 755 usagereport.sh
Then I just setup a cronjob crontab -e
(as zimbra user) to run this at 4:01 every monday morning, and email it to them.
1 4 * * 1 /root/usagereport.sh