Advanced message filter rules in Mozilla Thunderbird

You can also manually edit the msgFilterRules.dat file in the \Users... folder.

(A || B) && C becomes:

condition="AND (OR (body,contains,A) OR (body,contains,B) AND (to,contains,C)"

Note first parenthesis is mismatched.

Change the condition depending on your requirements. Look at other filters, or create test filters to learn the syntax empirically. Note there are several msgFilterRules.dat for different Email addresses and folders.


I strongly suggest using FiltaQuilla as suggested in MozillaZine.

Example

Hers is my filter for:

  • From contains @yahoo.es
  • Subject is photo, selfie or image, plus plurals, case insensitive

ThunderBird filter with regular expression


Take a look at the FiltaQilla AddOn - it allows regular expressions... :-)


A much less nice, but working solution, could be to convert your requirements to disjunctive normal form. That means creating several filters, each of them having "AND" parts. As multiple filters are independent, running them one after another simulates the "OR" part.

In your particular case, (message contains xy OR sender is yz) AND status is read = (message contains xy AND status is read) OR (sender is yz AND status is read).

That means you should create two filters, one for message contains xy AND status is read and the other for sender is yz AND status is read