How to zimbra add account to distribution list


In this tutorial, How do I use zimbra add account to distribution list by bash script. I’m written bash script for add account to distribution list.

You may reading link as below:

Zimbra add account to distribution list

The syntax, create distribution lists command line from root account
su - zimbra -c "zmprov adlm [email protected] [email protected]"
My bash script for zimbra add account to distribution list as below:
#!/bin/bash
#Author: HuuPV
#Add member to DL
echo -n "Input distribute name, pls (Ex: [email protected]): "
read DL
echo -n "Input account add to distribute name, pls (Ex: [email protected]): "
read AC
Check_Member_DL=$(su - zimbra -c "zmprov gdl $DL | grep '\b$AC'")
if [ $? == 0 ]
then
       echo "$AC member exists in $DL"
else
       echo "Add member $AC to $DL Distribute List"
       su - zimbra -c "zmprov adlm $DL $AC"
fi

The result, running bash script from root account
How to zimbra add account to distribution list

Conclusion

Thought the article, To help you can auto add account to distribution list from bash script. If you any question then comment below.

Comments

Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server

How to install php7 on centos 6