[Users] Filter is not working as expected

Marcio Andrey Oliveira plicatibu at gmail.com
Tue Oct 10 18:56:08 UTC 2023


Hi, Paul.

I re-ran some of my tests using exactly the condition you provided. You can
see below all tests performed as well as the results and the logs generated
by Claws.
The tests 3, 4, 5 and 6 failed. Looking at the logs, due to the fact that
 the first clause does not match and that both conditions must match (&) it
stops the filter before trying the second clause.
Regards.

Using the | instead of the &, the tests 1, 2, 4, 5 and 6 passed, but test 3
failed at the second match. My guess is that when there is someone in To or
Cc with example.com domain, the second condition fails (the case of test 3).
The tests 4, 5 and 6 didn't have emails from example.com in To and in Cc.

Regards

1) From: example.com To: 1 person from example.com ( From: Bruce Wayne <
bwayne at example.com>  To: dtracy at example.com )
Expected result: no highlight
Result:  no highlight - OK
Log:
[2023-10-10 11:41:32] filtering message (manually)
                       message file:
C:\Users\oliveira\AppData\Roaming\Claws-mail\imapcache\mail.example.com\
oliveira at example.com\Sent\5
                       Date: Tue, 10 Oct 2023 11:41:13 -0300
                       From: Bruce Wayne <bwayne at example.com>
                       To: dtracy at example.com
                       Subject: Test 1 - from coworker to coworker
[2023-10-10 11:41:32] processing rule 'highlight non-coworkers' [ ~from
matchcase "@example.com" & ~to_or_cc matchcase "@example.com" color 2 ]
> rule is not account-based
[2023-10-10 11:41:32] checking if message matches [ ~from matchcase "@
example.com" ]
[2023-10-10 11:41:32] From: header value [ Bruce Wayne <bwayne at example.com>
] contains [ @example.com ] (Case insensitive)
> message does not match


2) From: example.com To: 2 persons from example.com  (  From: Bruce Wayne <
bwayne at example.com>    To: dtracy at example.com, mo at example.com    )
Expected result: no highlight
Result: no highlight - OK
Log:
[2023-10-10 12:06:42] filtering message (manually)
                       message file:
C:\Users\oliveira\AppData\Roaming\Claws-mail\imapcache\mail.example.com\
oliveira at example.com\Sent\6
                       Date: Tue, 10 Oct 2023 11:43:50 -0300
                       From: Bruce Wayne <bwayne at example.com>
                       To: dtracy at example.com, mo at example.com
                       Subject: Test 2 - from coworker to 2 coworkers
[2023-10-10 12:06:42] processing rule 'highlight non-coworkers' [ ~from
matchcase "@example.com" & ~to_or_cc matchcase "@example.com" color 2 ]
> rule is not account-based
[2023-10-10 12:06:42] checking if message matches [ ~from matchcase "@
example.com" ]
[2023-10-10 12:06:42] From: header value [ Bruce Wayne <bwayne at example.com>
] contains [ @example.com ] (Case insensitive)
> message does not match


3) From: example.com To: 1 person from example.com Cc: from an external
domain (  From: Bruce Wayne <bwayne at example.com>   To: dtracy at example.com
Cc: regularjoe at gmail.com    )
Expected result: highlight
Result: NO highlight - ERROR
Log:
[2023-10-10 12:09:36] filtering message (manually)
                       message file:
C:\Users\oliveira\AppData\Roaming\Claws-mail\imapcache\mail.example.com\
oliveira at example.com\Sent\7
                       Date: Tue, 10 Oct 2023 12:09:10 -0300
                       From: Bruce Wayne <bwayne at example.com>
                       To: dtracy at example.com
                       Subject: Test 3 - from coworker to coworker cc
external
[2023-10-10 12:09:36] processing rule 'highlight non-coworkers' [ ~from
matchcase "@example.com" & ~to_or_cc matchcase "@example.com" color 2 ]
> rule is not account-based
[2023-10-10 12:09:36] checking if message matches [ ~from matchcase "@
example.com" ]
[2023-10-10 12:09:36] From: header value [ Bruce Wayne <bwayne at example.com>
] contains [ @example.com ] (Case insensitive)
> message does not match



4) From: example.com  To: 1 person from external domain (  From: Bruce
Wayne <bwayne at example.com>   To: regularjoe at gmail.com )
Expected result: highlight
Result: NO highlight - ERROR
Log:
[2023-10-10 12:17:42] filtering message (manually)
                       message file:
C:\Users\oliveira\AppData\Roaming\Claws-mail\imapcache\mail.example.com\
oliveira at example.com\Sent\8
                       Date: Tue, 10 Oct 2023 12:17:05 -0300
                       From: Bruce Wayne <bwayne at example.com>
                       To: regularjoe at gmail.com
                       Subject: Test 4 - from coworker to external
[2023-10-10 12:17:42] processing rule 'highlight non-coworkers' [ ~from
matchcase "@example.com" & ~to_or_cc matchcase "@example.com" color 2 ]
> rule is not account-based
[2023-10-10 12:17:42] checking if message matches [ ~from matchcase "@
example.com" ]
[2023-10-10 12:17:42] From: header value [ Bruce Wayne <bwayne at example.com>
] contains [ @example.com ] (Case insensitive)
> message does not match


5) From: example.com  Cc: 1 person from external domain (  From: Bruce
Wayne <bwayne at example.com>   Cc: regularjoe at gmail.com )
Expected result: highlight
Result: NO highlight - ERROR
Log:
[2023-10-10 12:19:14] filtering message (manually)
                       message file:
C:\Users\oliveira\AppData\Roaming\Claws-mail\imapcache\mail.example.com\
oliveira at example.com\Sent\9
                       Date: Tue, 10 Oct 2023 12:18:53 -0300
                       From: Bruce Wayne <bwayne at example.com>
                       To: (NULL)
                       Subject: Test 5 - from coworker cc external
[2023-10-10 12:19:14] processing rule 'highlight non-coworkers' [ ~from
matchcase "@example.com" & ~to_or_cc matchcase "@example.com" color 2 ]
> rule is not account-based
[2023-10-10 12:19:14] checking if message matches [ ~from matchcase "@
example.com" ]
[2023-10-10 12:19:14] From: header value [ Bruce Wayne <bwayne at example.com>
] contains [ @example.com ] (Case insensitive)
> message does not match


6) From: example.com  To: 2 persons from an external domain (  From: Bruce
Wayne <bwayne at example.com>  To: regularjoe at gmail.com, dude at gmail.com )
Expected result: highlight
Result:
Log:
[2023-10-10 12:34:20] filtering message (manually)
                       message file:
C:\Users\oliveira\AppData\Roaming\Claws-mail\imapcache\mail.example.com\
oliveira at example.com\Sent\10
                       Date: Tue, 10 Oct 2023 12:33:59 -0300
                       From: Bruce Wayne <bwayne at example.com>
                       To: regularjoe at gmail.com, dude at gmail.com
                       Subject: Test 6 - from coworker to external external
[2023-10-10 12:34:20] processing rule 'highlight non-coworkers' [ ~from
matchcase "@example.com" & ~to_or_cc matchcase "@example.com" color 2 ]
> rule is not account-based
[2023-10-10 12:34:20] checking if message matches [ ~from matchcase "@
example.com" ]
[2023-10-10 12:34:20] From: header value [ Bruce Wayne <bwayne at example.com>
] contains [ @example.com ] (Case insensitive)
> message does not match


Em ter., 10 de out. de 2023 às 10:23, Paul <paul at claws-mail.org> escreveu:

> On Tue, 10 Oct 2023 08:45:53 -0300
> Marcio Andrey Oliveira <plicatibu at gmail.com> wrote:
>
> > Thank you for replying. I already tried that, but it doesn't work when
> > there is more than one email in the To or Cc field, that's the reason I
> > used the regex.
>
> Did you try that? It works for me when there is more than one.
>
> > Also, in the filter you wrote, the "&" should be "|" :)
>
> I think what you want is "&", you want the address to be in none of From,
> To
> or Cc.
>
> with regards
>
> Paul
> _______________________________________________
> Users mailing list
> Users at lists.claws-mail.org
> https://lists.claws-mail.org/cgi-bin/mailman/listinfo/users
>


More information about the Users mailing list