EzyMailHostingAdministration

How to get a list of all distribution list members

You can easily check the account names and email addresses in each distribution list (email). Just copy the script below and run it as the zimbra user.


#!/bin/sh

echo  >  /tmp/groupslist.txt

for LISTNAME in `zmprov gadl`
do
    echo $LISTNAME >> /tmp/groupslist.txt
        echo "-------------------------------" >> /tmp/groupslist.txt
        for LISTMEMBER in `zmprov gdl $LISTNAME | grep zimbraMailForwardingAddress | cut -f2 -d " "`
        do
              DISPLAYNAME=`zmprov ga $LISTMEMBER | grep displayName | cut -f2,3 -d " "`
              echo "${DISPLAYNAME} ${LISTMEMBER}" >> /tmp/groupslist.txt
        done
    echo  >> /tmp/groupslist.txt
done
EOF.← Back to articles