Powered by Blogger.

How To Export/Import Signature on Zimbra Mail Server

After migrating quotas that has been explained on previous article, i am also should be migrated signature from old Zimbra to the new Zimbra. The following is what i do for migrating signature from old to the new Zimbra
Export (on the old Zimbra)
# Create simple script for retrieve information of signature
cd /srv/
mkdir sig
vi export-signature.sh
Fill with the following line
#!/bin/bash

clear
mkdir -p /tmp/sig
echo "Retrieve zimbra user name..."

USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;

for ACCOUNT in $USERS; do
NAME=`echo $ACCOUNT`;
sign=`su - zimbra -c "zmprov ga $NAME zimbraPrefMailSignature" > /tmp/sig/$NAME`
sed -i -e "1d" /tmp/sig/$NAME
sed 's/zimbraPrefMailSignature: //g' /tmp/sig/$NAME > sig/$NAME
rm /tmp/sig/$NAME
echo "Export signature for $NAME..."
done
echo "All signature has been export successfully"
# Save and execute
chmod +x export-signature.sh
sh export-signature.sh
The all result of above command are files which is saved in /srv/sig folder. Copy sig folder to the new Zimbra
Import (on the new Zimbra)
Assuming sig folder is placed in /srv/ folder. Make the simple script for importing signature who has been exported
cd /srv/
vi import-signature.sh
Fill with the following line
for file in /srv/sig/*
do
StrSign=`cat "$file"`
Acc=`echo $file | cut -d "/" -f5`
su - zimbra -c "zmprov ma $Acc zimbraPrefMailSignature '$StrSign'"
echo "Process import signature $Acc"
done
echo "Process import signature has been finished"
Note : The signature who has been export/import is only text signature (not include html). Until now, i am have not yet found how to export html signature from Zimbra 😀
Good luck and hopefully useful 😀
Thanks to : Masim “Vavai” Sugianto at www.vavai.net
    Blogger Comment
    Facebook Comment