Hey all, I wrote a script that dumps all of the primary email addresses, aliases, and distribution lists in a small efficient shell script. I thought I'd share it here so I don't lose it.
Code:
#!/bin/bash
set -o nounset # exit on unset variables
set -o errexit # exit if command exits with non-zero value
if [ "$(whoami)" != "zimbra" ]; then
echo "This script must be run as the zimbra user."
exit 1
fi
RESULTS=( $(zmprov -l gaa -v | grep -E "zimbraMailAlias|zimbraMailDeliveryAddress" ) )
EMAILS=( ${RESULTS[@]/zimbraMail*/} )
for EMAIL in "${EMAILS[@]}"; do
echo "$EMAIL"
done
zmprov gadl Any improvements are welcome. Use it however you like and at your own risk.