How to transfer rules/filters from one zimbra account to another

May 28th, 2014 | By | Category: Internet, Linux / Freebsd

Well it would appear that the vast majority of links and literature on this subject is outdated and no longer working although it’s not terribly broken it just needs a slight tweak which I’ll post below.  A big thanks to the guys over here: http://www.spheron1.co.uk/2011/06/27/zimbra-mailbox-importexport-and-migration-of-e-mail-filter-rules/ for having the only working solution i found

 

So first you want to export your mail rules from user A by doing this:

zmprov ga user@test.com zimbraMailSieveScript > /opt/backup/xferMailFilters.sh

now you need to import them into another user so go and edit this new mailFilters.sieve file and change the top 2 lines from this

*NOTE: IF YOU ARE COPYING AND PASTING DIRECTLY FROM THIS PAGE YOU WILL HAVE TO MANUALLY REPLACE TO STUPID ASS WORDPRESS SINGLE QUOTES WITH A PROPER ONE AS IT WILL COMPLETELY BREAK YOUR SCRIPT.

#Name user@test.com

zimbraMailSieveScript: require [“fileinto”, “reject”, “tag”, “flag”];

to this

#!/bin/bash

if [[ $1 ]];

then

zmprov ma $1 zimbraMailSieveScript ‘require [“fileinto”, “reject”, “tag”, “flag”];

 

and add this to the very end of the file

else

echo “You forgot to enter a user – Syntax: xferMailFilters.sh user@whatever.com”

fi

 

chmod your new script to 755 or add a +x to it and then run it with the username you want to xfer these files over to as your first variable.  You can use this logic and add onto this to make a script that will export from one user($1) and xfer to another ($2) but that’s out side of what I need right now so I’ll leave that one up to you 🙂

Tags: , , ,

4 Comments to “How to transfer rules/filters from one zimbra account to another”

  1. Edward Dore says:

    You’re welcome, glad to hear that my blog post was helpful to someone 🙂

  2. admin says:

    Truly, I used my little filter xfer script just last week!

  3. Ben says:

    Thanks for this little how to. Exactly what i was looking for. One thing, could you give an example of how you would run the script as a different user? As a zimbra admin newbie I cant quite get the syntax right and an example of running the script would go a long way 🙂

  4. Edward Dore says:

    Hi Ben, if you take a look at the post on my site (the spheron1.co.uk link) then you should be able to use that to specify the user when importing.

Leave a Comment