[imapfilter-devel] Filter Issues w/More Than 2 Masks Using 'OR'

Lefteris Chatzibarbas lefcha at hellug.gr
Wed Feb 18 12:57:59 EET 2004


On Tue, Feb 17, 2004 at 03:56:34PM -0600, Steven T Zydek wrote:
>  Hello,
> 
> I'm a very new user to imapfilter, which I think is a fabulous tool
> btw. I've compiled for both Solaris 8 and Red Hat Linux using gcc.
> Everything appears to be working fine except one issue I'm having
> w/filters. To best illustrate the problem, see the following:
> 
> my .imapfilterrc contains:
> 
>    filter spam or
>       mask From microsoft.com
>       mask From Microsoft
>       mask From ms.net
>    action move Junk
> ## --------------------
> 
> yet, when it runs it does the following:
> 
> C: 100B SEARCH OR (FROM "microsoft.com") OR (FROM "Microsoft") (FROM "ms.net")
> S: 100B OK SEARCH completed.
> 
> If you look closely, it appears that the 'OR' was dropped from the
> '(FROM "ms.net") check.

Actually, the IMAP protocol uses prefix notation, and so the "OR"
operator precedes all its operands.  For example:

	a OR b

... in prefix notation becomes:

	OR a b

Likewise:

	a OR b OR c

... becomes:

	OR a OR b c

... and with some parentheses added for clarification:

	OR (a) (OR b c)


> I've tested this against existing IMAP inboxes where I have messages
> that definitely match the masks set for the third or fourth instances
> in the filter list, yet don't get processed (i.e., moved) as expected.
> When I remove all mask lines except for these same two, they get
> caught and moved perfectly. But as soon as I add a third mask back, it
> appears to ignore all the masks.
> 
> So, both of the masks get processed fine in the the following filter:
> 
> ## filter out spam mail
> filter spam or
>       mask From microsoft.com
>       mask From ms.net
> action move Junk
> ## -----------------
> 
> If I add another mask line to the above filter, even if a message on
> the server matches, nothing gets processed.
> 
> Any ideas??

What is the name/version of the IMAP server you are connecting to?

It would be also helpful if you compiled imapfilter with DEBUG enabled
("./config -o debug=yes" and then compile) and send me the output.
Don't forget to manually remove any sensitive date (passwords, etc.).




More information about the Imapfilter-devel mailing list