Nice!
I always forget about the scripting aspect of Zimbra.
That will inject every account though, which is good but it will include the spam/ham/wiki accounts, and any others that dont recieve mail. I've modified the script a little so that a list of accounts can be specified which will then be removed from the list.
Code:
##!/bin/bash
# --- Config section
LISTNAME=allstaff@domain.com
REMOVENAMES=( zimbra_spam@mail.comain.com zimbra_ham@mail.domain.com wiki@mail.domain.com otheraccount@domain.com )
# --- End config
# Delete existing list
echo "Removing old copy of $LISTNAME..."
zmprov ddl $LISTNAME
echo -e "...done \n"
# Create new list
echo "Adding all accounts to $LISTNAME..."
zmprov cdl $LISTNAME
for acct in `zmprov -l gaa`; do
echo "adlm $LISTNAME $acct"
done | zmprov
echo -e "\n...done \n"
# Remove accounts from list that are known to be non-user accounts
echo "Removing non-account addresses..."
for acct in ${REMOVENAMES[@]}; do
echo "rdlm $LISTNAME $acct"
done | zmprov
echo -e "\n...done \n" That seems to work, I could even add that as a cron task but that feels excessive
