How To Export/Import Signature on Zimbra Mail Server

Posted by

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

1.cd /srv/
2.mkdir sig
3.vi export-signature.sh

Fill with the following line

01.#!/bin/bash
02. 
03.clear
04.mkdir -p /tmp/sig
05.echo "Retrieve zimbra user name..."
06. 
07.USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;
08. 
09.for ACCOUNT in $USERS; do
10.NAME=`echo $ACCOUNT`;
11.sign=`su - zimbra -c "zmprov ga $NAME zimbraPrefMailSignature" > /tmp/sig/$NAME`
12.sed -i -e "1d" /tmp/sig/$NAME
13.sed 's/zimbraPrefMailSignature: //g' /tmp/sig/$NAME > sig/$NAME
14.rm /tmp/sig/$NAME
15.echo "Export signature for $NAME..."
16.done
17.echo "All signature has been export successfully"

# Save and execute

1.chmod +x export-signature.sh
2.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

1.cd /srv/
2.vi import-signature.sh

Fill with the following line

1.for file in /srv/sig/*
2.do
3.StrSign=`cat "$file"`
4.Acc=`echo $file | cut -d "/" -f5`
5.su - zimbra -c "zmprov ma $Acc zimbraPrefMailSignature '$StrSign'"
6.echo "Process import signature $Acc"
7.done
8.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

3 comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.