zimbra create multiple accounts csv file
I will writing the script for create multiple accounts from csv file.
- To create Accounts.csv file
- To use bash script create multiple accounts in zimbra
- To execute zimbra_account.sh bash script
# cat Accounts.csvThe content Accounts.csv file as below:
huupv1@mail.huuphan.local,123456789,Huu1,Phan Van,Phan Van Huu1 (IT),mail.huuphan.local
huupv2@mail.huuphan.local,123456789,Huu2,Phan Van,Phan Van Huu2 (IT),mail.huuphan.local
zimbra create multiple accounts csv file full script
zimbra create multiple accounts with zimbra_account.sh name#!/bin/bashTo execute bash script
# File Accounts.csv as below:
# huupv1@mail.huuphan.local,123456789,Huu1,Phan Van,Phan Van Huu1 (IT),mail.huuphan.local
# huupv2@mail.huuphan.local,123456789,Huu2,Phan Van,Phan Van Huu2 (IT),mail.huuphan.local
DATE=$(date)
OLDIFS=$IFS
IFS=','
File_Name="/opt/Account/Accounts.csv"
Out_log='/tmp/outfile.log'
echo "$DATE - To create account Email" | tee $Out_log
echo "Account, Password, First_Name, Last_Name, DisplayName, zimbraMailHost" | tee -a $Out_log
while read Acount_Email Password First_Name Last_Name Display_Name Mailbox
do
echo "$Acount_Email, $Password, $First_Name, $Last_Name, $Display_Name, $Mailbox" | tee -a $Out_log
echo ""
Uid=$(echo $Acount_Email | cut -d '@' -f1)
Domain=$(echo $Acount_Email | cut -d '@' -f2)
su - zimbra -c "zmprov -l gaa | grep '\b$Uid'@$Domain"
if [ $? -eq 0 ] ; then
echo "$Acount_Email exits"
else
su - zimbra -c "zmprov ca '$Acount_Email' '$Password' givenName '$First_Name' sn '$Last_Name' displayName '$Display_Name' zimbraMailHost '$Mailbox'" >>$Out_log
fi
done < ${File_Name}
IFS=$OLDIFS
#./zimbra_account.sh
ERROR: service.INVALID_REQUEST (invalid request: must be valid email address: account)
ReplyDeleteI am getting such an error can cause problems
I have same error. ERROR: service.INVALID_REQUEST (invalid request: must be valid email address: account)
ReplyDeleteHello,
ReplyDeleteI can't solve problem below. Hostname is true. Can you help me ?
ERROR: service.INVALID_REQUEST (invalid request: specified zimbraMailHost does not correspond to a valid server service hostname: mail.xxx.xxx)