This thread looked like a good place to get some advice on a similar problem we're having. We're migrating users from Cyrus IMAP to Zimbra, and one of the things we want to do is preserve their message filters. The cyrus filters we have in place use Sieve-style syntax, so we don't have to convert one kind of filter syntax to another; I'm just having trouble getting the procedure outlined above to work properly.
I have a script that parses the server-side filter script for a particular user and appends the filters to a file intended to be piped to zmprov. The format of this file is as follows (for an example user jdoe):
Code:
ma jdoe zimbraMailSieveScript '\
require ["imapflags", "fileinto"];\
# backups no news is good news\
if allof ( header :comparator "i;ascii-casemap" :contains "List-Id" "backup-reports.lists.example.domain",
header :comparator "i;octet" :matches "Subject" "*SUCCEEDED", address :all :comparator "i;ascii-casemap
" :contains "From" "root@example.domain", header :comparator "i;ascii-casemap" :matches "Subject" "[backup
-reports]*" ) { \
discard;\
} \
# Test Filter\
if allof ( header :comparator "i;ascii-casemap" :contains "Subject" "testing", address :all :comparator
"i;ascii-casemap" :contains "From" "jdoe" ) { \
addflag "\\Flagged";\
fileinto "testing";\
removeflag "\\Flagged";\
stop;\
} \
' When I pipe this into zmprov, I get no errors, but the zimbraMailSieveScript attribute looks wrong, and the filters for the user I populated do not appear in the web interface as expected. Here's what 'zmprov ga jdoe' shows for the zimbraMailSieveScript attribute:
Code:
zimbraMailSieveScript: require ["imapflags", "fileinto"];# backups no news is good newsif allof ( header :comparator "i;ascii-casemap" :contains "List-Id" "backup-reports.lists.example.domain", header :comparator "i;octet" :matches "Subject" "*SUCCEEDED", address :all :comparator "i;ascii-casemap" :contains "From" "root@example.domain", header :comparator "i;ascii-casemap" :matches "Subject" "[backup-reports]*" ) { discard;} # Test Filterif allof ( header :comparator "i;ascii-casemap" :contains "Subject" "testing", address :all :comparator "i;ascii-casemap" :contains "From" "jdoe" ) { addflag "\Flagged"; fileinto "testing"; removeflag "\Flagged"; stop;} It looks like newlines aren't being preserved, but I'm not sure what's wrong with the format of the file I'm piping to zmprov. Can anyone help me out?
Thanks,
~Dave Flynn