Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Users

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack (2) Thread Tools Display Modes
  #11 (permalink)  
Old 07-10-2007, 01:12 PM
Member
 
Posts: 14
Default

Some additional information:

Curious about the lack of newlines where there ought to be some, I manually tweaked the zmprov.script file (the thing I'm piping to zmprov). It now looks like this:

Code:
ma dflynn zimbraMailSieveScript '\
require ["fileinto", "reject", "tag", "flag"];\
\n# Helpdesk Tickets\
\nif anyof (header :contains "subject" "[Lib Help #" )\
\n{\
\n    tag "Tickets";\
\n    flag "flagged";\
\n    stop;\
\n}\
'
When I pipe this file into zmprov, and then run 'zmprov ga dflynn', I get the following for the zimbraMailSieveScript attribute:

Code:
zimbraMailSieveScript: require ["fileinto", "reject", "tag", "flag"];
# Helpdesk Tickets
if anyof (header :contains "subject" "[Lib Help #" )
{
    tag "Tickets";
    flag "flagged";
    stop;
}
This looks close to how it should be (judging by the same attribute format on my production Zimbra server, which was created using the filters GUI in the web interface). Unfortunately, I still don't see any filters in the web interface for this account, and I still can't create new ones (I get the error mentioned in my previous post).
Reply With Quote
  #12 (permalink)  
Old 07-10-2007, 02:27 PM
Senior Member
 
Posts: 57
Default

Looks like this is broken in 4.5.6. I just tested and had the same results. One line in the attribute tag and no filters listed in the UI. You might search for or open a bug for this.

Code:
[zimbra@zebra tmp]$  cat filters.zmp
ma jdemo zimbraMailSieveScript '\
require ["fileinto", "reject", "tag", "flag"];\
# Helpdesk Tickets\
if anyof (header :contains "subject" "[Lib Help #" )\
{\
    tag "Tickets";\
    flag "flagged";\
    stop;\
}\
'
[zimbra@zebra tmp]$ zmprov < filters.zmp
[zimbra@zebra tmp]$ zmprov ga jdemo |grep Sieve
zimbraMailSieveScript: require ["fileinto", "reject", "tag", "flag"];# Helpdesk Ticketsif anyof (header :contains "subject" "[Lib Help #" ){    tag "Tickets";    flag "flagged";    stop;}
Reply With Quote
  #13 (permalink)  
Old 07-10-2007, 02:55 PM
Member
 
Posts: 14
Default

Interesting. I'll look into the bug reports and if I don't see something relevant, I'll call up support and ask them about it.

Thanks for looking into this - I appreciate your help.

~Dave
Reply With Quote
  #14 (permalink)  
Old 07-12-2007, 03:34 PM
Zimbra Employee
 
Posts: 512
Default

The right way to do this is probably through zmmailbox:
Code:
zmmailbox -z -m f@test.test addFilterRule "tag special" active any header "subject" contains "special" tag "special" stop
If you still want to work through zmprov, note that you need a blank line before and after all the filter definitions. To start with, this works for me:

Code:
zmprov modifyAccount f@test.test zimbraMailSieveScript 'require ["fileinto", "reject", "tag", "flag"];

# tag special
if anyof (header :contains "subject" "special" )
{
    tag "special";
        stop;
}
'
That's not especially automated, though, but this perl script does the same thing. The important thing is the single quotes around the $s in the zmprov command.

Code:
#!/usr/bin/perl

$s='require ["fileinto", "reject", "tag", "flag"];

# tag special
if anyof (header :contains "subject" "special" )
{
    tag "special";
    stop;
}
';

$c="zmprov modifyAccount f\@test.test zimbraMailSieveScript '$s'";
system($c);
This is all on Release 4.5.6_GA_1024.RHEL4_20070627170556 RHEL4 NETWORK edition, and the filter matches and tags messages appropriately.
__________________
Search the Forums - Bugzilla - Wiki - Downloads

Last edited by bobby : 07-12-2007 at 03:46 PM.
Reply With Quote
  #15 (permalink)  
Old 07-13-2007, 06:02 AM
Outstanding Member
 
Posts: 596
Default Zimbra filters case sensitivity and extensions

Are Zimbra filter rules case-sensitive?

What happens if we attempt to define sieve rules with

:comparator "i;ascii-casemap" or :comparator "i;octet"?

Are there any other sieve extensions common to Cyrus (specifically Cyrus sieve rules created with Horde's Ingo interface) that we need to look out for?
Reply With Quote
  #16 (permalink)  
Old 07-16-2007, 07:17 PM
Zimbra Employee
 
Posts: 512
Default

The filters UI doesn't really support this (yet), but you can specify the comparator when submitting the raw sieve filter via zmprov. After adding this filter, messages with uppercase "STUFF" in the subject get the "STUFF" tag, but messages with lowercase "stuff" don't:

Code:
[zimbra@support5 ~]$ zmprov modifyAccount f@test.test zimbraMailSieveScript 'require ["fileinto", "reject", "tag", "flag"];

# tag STUFF
if anyof (header :contains :comparator "i;octet" "subject" "STUFF" )
{
    tag "STUFF";
        stop;
}
'
__________________
Search the Forums - Bugzilla - Wiki - Downloads
Reply With Quote
  #17 (permalink)  
Old 07-17-2007, 09:50 AM
Member
 
Posts: 14
Default

This is still not working in the way we expect. When I execute the following script:

Code:
#!/usr/bin/perl

$s='require ["fileinto", "reject", "tag", "flag"];

# tag special
if anyof (header :contains "subject" "special" )
{
    tag "special";
    stop;
}
';

$c="zmprov modifyAccount dflynn zimbraMailSieveScript '$s'";
system($c);
I can then examine my account:

Code:
zmprov ga dflynn
Which shows for the zimbraMailSieveScript attribute:

Code:
zimbraMailSieveScript: require ["fileinto", "reject", "tag", "flag"];

# tag special
if anyof (header :contains "subject" "special" )
{
        tag "special";
        stop;
}
All of this looks correct. When I log into the web client, however, and go to my filters, I do not see the one I set through zmprov. If I then set up a filter through the GUI, the zimbraMailSieveScript attribute is overwritten; for example, below is what I see after adding a very simple filter through the web interface immediately after I ran the perl script above.

Code:
zimbraMailSieveScript: require ["fileinto", "reject", "tag", "flag"];

# test
if anyof (header :is "subject" "test" )
{
    discard;
    stop;
}
It isn't immediately clear if the first filter is still working or not, but it is definitely not visible in the web interface. Am I still doing something wrong? Am I wrong to think that a filter I configure through zmprov in this way should be visible (and configurable!) through the web interface?

Thanks,

~Dave
Reply With Quote
  #18 (permalink)  
Old 07-17-2007, 10:14 AM
Zimbra Employee
 
Posts: 512
Default

:/ yeah, I've been restarting tomcat and reloading the web client to make the change show up
__________________
Search the Forums - Bugzilla - Wiki - Downloads
Reply With Quote
  #19 (permalink)  
Old 07-17-2007, 10:24 AM
Member
 
Posts: 14
Default

Ok, I'll give that a shot.

For the record, while it might be a little annoying to have to restart Tomcat to make this show up to the web interface, what we're doing here is scripting for a large number of users the migration of their Cyrus/Horde filter rules into Zimbra. Once we have the process working and tested, we'll probably do it all at once, in which case restarting Tomcat once to propagate the changes to the web interface is a reasonable thing to do.

As long as we can use zmprov to migrate the filters and make them visible through the web interface somehow, that's good enough for me. This might be a nice thing to 'fix' in a future release, but as we've noted elsewhere in this thread zmprov isn't really the right tool to begin with. I'd rather use zmprov and restart Tomcat than parse several thousand filter rules and rewrite them into something that zmmailbox understands.
Reply With Quote
  #20 (permalink)  
Old 07-18-2007, 09:49 AM
Member
 
Posts: 14
Default

Quote:
The filters UI doesn't really support this (yet), but you can specify the comparator when submitting the raw sieve filter via zmprov. After adding this filter, messages with uppercase "STUFF" in the subject get the "STUFF" tag, but messages with lowercase "stuff" don't
Does this mean that if I import a filter using zmprov that contains a (for example) :comparator directive, the filter will work but won't show up in the ZWC GUI?

I ask because I've been able to get some filters to work properly (properly meaning I import them using zmprov ma account@domain zimbraMailSieveScript ..., and I can both test that they work and edit them from the ZWC), and some that do not work. In some cases, the zmprov import seems to work, but the filter doesn't appear to be active, and more importantly it breaks the filter portion of the web client for the affected account - not only can I not see the newly added filter(s), I get an error if I try to create a new one.
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0