November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

How to check mailbox size of all accounts in Zimbra mail server

I would like to check a mailbox size of all users in my Zimbra mail server and I can check these sizes by create a shell script which has 2 commands for query.

1. zmprov gaa => I use this command for query all accounts in my Zimbra server.
2. zmmailbox -z -m your-account gms => Get mailbox size of your-account account

For all user we can use use a bash script.

# su zimbra
#vim zmchkmailsize.sh

#!/bin/sh
WHO=`whoami`
if [ $WHO = “zimbra” ]
then
all_account=`zmprov -l gaa`;
for account in ${all_account}
do
mb_size=`zmmailbox -z -m ${account} gms`;
echo “Mailbox size of ${account} = ${mb_size}”;
done
else
echo “Execute this script as user zimbra (\”su – zimbra\”)”
fi

:wq
# chmod 755
# ./zmchkmailsize.sh

OUTPUT:

Mailbox size of admin@example.com.com = 15.74 KB

Mailbox size of spam.g1oxhlgg@example.com = 0 B

Mailbox size of ham.hp_pg_h5@iexample.com = 0 B

Mailbox size of virus-quarantine.cs29ig2sm@example.com = 0 B

Mailbox size of xxx.yyy@example.com = 1.70 KB

Mailbox size of xxx.yyy@example.com = 1.29 KB

Mailbox size of xxx.yyy@example.com = 0 B

Mailbox size of xxx.yyy@example.com = 0 B

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>