Migrating Zimbra Sieve filter rules from one user to another user

In this article you will learn how to migrate filter rules from one user to another user. These are the steps to export and import filter rules from the command line, don’t forget to use the zimbra OS user:

1) Export exiting filter rules of a user and save into a file.

zmprov -l ga UserA@DOMAIN.COM zimbraMailSieveScript > /tmp/filter_rules.txt  

2) Prepare the output file “/tmp/filter_rules.txt”.

sed -i -e "1d" /tmp/filter_rules.txt 
sed -i -e 's/zimbraMailSieveScript: //g' /tmp/filter_rules.txt

3) Check required folders’ path for the filter rules.

cat /tmp/filter_rules.txt | grep 'fileinto ' 


zimbra@mail:~$ cat /tmp/filter_rules.txt | grep 'fileinto '
    fileinto "TestEmail/TEST2";
    fileinto "User5";
    fileinto "Admin";

4) Import prepared filter rules on another user.

zmprov ma UserB@DOMAIN.COM zimbraMailSieveScript "`cat /tmp/filter_rules.txt`"  

5) Create all required folders for the imported filter rules from the step 3.

zmmailbox -z -m UserB@DOMAIN.COM cf -V message /"FolderName"


zmmailbox -z -m UserB@DOMAIN.COM cf -V message /"User5" 

Further reading



No comments yet.

Leave a Reply

Copyright © 2022 Zimbra, Inc. All rights reserved.

All information contained in this blog is intended for informational purposes only. Synacor, Inc. is not responsible or liable in any manner for the use or misuse of any technical content provided herein. No specific or implied warranty is provided in association with the information or application of the information provided herein, including, but not limited to, use, misuse or distribution of such information by any user. The user assumes any and all risk pertaining to the use or distribution in any form of any subject matter contained in this blog.

Legal Information | Privacy Policy | Do Not Sell My Personal Information | CCPA Disclosures