Mailboxes By Distribution List

Revision as of 01:25, 16 August 2010 by Richardteachout (talk | contribs) (Initial Creation page.. hope it helps someone else.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

One of our domains has about 100 distribution lists for each of their departments/offices, and requested a way to get a breakdown of all of their users, and which distribution lists they were in.

I saved this file in /opt/zimbra/backup/scripts/ as, owned by zimbra.zimbra chmod 755


rm -f $output
touch $output

for i in `zmprov -l gaa | grep $domain|sort`
echo "$i" >> $output
zmprov gam $i|while read line; do echo "     $line" >> $output; done
cat $output | mail @SendTo -s"User/Distribution list Breakdown for $domain"

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 /opt/zimbra/backup/scripts/

You could easily modify this to run through each domain on your server, and send a report to each domain, if you wanted (just add another for loop)
The output looks something like this (alphabetically for all users) (via (via (via (via (via

They then can at a quick glance, see if there are any users in NO distribution lists, for example, without having to go through each user one by one, or each distribution list! :)

Jump to: navigation, search