Empty Zimbra ML and populate it from file

or populate from file



Step 1

do a backup of the mailing list


zmprov gdlm NAME OF THE ML | tail -n +4 > /PATH/OF/THE/BACKUPFILE/FILENAME.txt


Step 2

Extract ML members and remove them


for a in `zmprov gdlm NAME OF THE ML | tail -n +4` ; do
   zmprov rdlm NAME OF THE ML $a


Step 3

Import new members (or add members) from a previously prepared text file, this version is a bash executable file named add-to-ml.sh with this content

for i in $(cat ${1}); do
   zmprov adlm NAME OF THE ML $i


The usage is this


(the .txt extension is not mandatory but the file must be executable for the owner, chmod +x)

 For tips on how to clean a list of email addresses see my previous post:


(in italian)