[Dovecot] filtering problem using sieve

Rui Lopes rgl at ruilopes.com
Mon Aug 28 16:03:42 EEST 2006


ajmcello ajmcello wrote:
>  
>  
> For some reason, I cannot filter messages that have uppercase or 
> possibly mixed casing in them. I have tried several tests by connecting
> to port 25 and sending messages. The ones that fail are from 
> MAILER-DAEMON at mydomain.net <mailto:MAILER-DAEMON at mydomain.net>. Here are 
> the rules I have tried:
>  
>  
> require ["fileinto", "reject", "vacation"];
>  
> if header :contains ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] 
> "mailer-daemon at mydomain.net <mailto:mailer-daemon at mydomain.net>" {
>         fileinto "mailer-daemon";
>         stop;
> }
> 
> if header :contains ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] 
> "MAILER-DAEMON at mydomain.net <mailto:MAILER-DAEMON at mydomain.net>" {
>         fileinto "mailer-daemon";
>         stop;
> }
> 
> if header :contains ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] 
> "MAILER-DAEMON at mail.mydomain.net <mailto:MAILER-DAEMON at mail.mydomain.net>" {
>         fileinto "mailer-daemon";
>         stop;
> }
> 
> if header :contains ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] 
> "mailer-daemon at mail.mydomain.net <mailto:mailer-daemon at mail.mydomain.net>" {
>         fileinto "mailer-daemon";
>         stop;
> }
> 
>  
> 
> They all fail to deliver to my mail folder "mailer-daemon" and go to my 
> inbox instead.
> 
> Anybody have any ideas what I am doing wrong?

AFIK, from the Sieve RFC draft[1], strings compare case-insensitive when 
no :comparator argument is given in the action, so I really don't known 
what is wrong, you could try to force the comparator, eg:


   if header
     :comparator "i;ascii-casemap"
     :contains
       ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"]
       [
         "mailer-daemon at one.example.com",
         "mailer-daemon at two.example.com",
         "mailer-daemon at three.example.com"
       ] {
     fileinto "mailer-daemon";
     stop;
   }


Though, here, it works fine with(out) it.



> Also, how can I add a 
> wildcard so that I do not have to
> 
> specify subdomains?

Instead of ":contains" you can use ":matches", eg:

   if header :matches "to" "mailer-daemon@*" {...}


HTH,
Rui Lopes


[1] "2.7.3.   Comparators" section at 
http://www.ietf.org/internet-drafts/draft-ietf-sieve-3028bis-09.txt


More information about the dovecot mailing list