I want to take email messages and sort them in to subfolders in my IMAP account using my MUA, Mozilla Thunderbird.

I set a filter "move bob@example.com" to match and it moves the emails to subfolder "bob".

Then I set a filter "move subject:'IT helpdesk answer'" to match and move to a different subfolder "helpdesk".

The mails get shuttled between the two subfolders perpetually if the two filters match.

I can hack it by adding an AND with "is not tagged as 'moved'" then add an action to each message filter that adds a tag 'moved'. However this means a new filter is needed for every filtering characteristic (like I want to filter 50 different partial email addresses in to a 'shopping' folder; I'd need to make 50 filters), I can no longer do "move bob@example.com or ted@example.com to 'friends' subfolder" - it would instead take two filters because Thunderbird can't do compound logic (it can't do 'NOT tag AND (A OR B)'; it can do 'NOT tag AND A').

There's a "stop filter execution" but it doesn't seem to do anything.

How am I supposed to do this in Thunderbird (on Kubuntu 18.04.1), I just want to presort emails in to different folders as they arrive. Thanks.

  • If the filter is working on incoming mail, it should only act on the inbox. It shouldn't move it to subfolder bob, and then move it from there to subfolder helpdesk, and go into an endless loop of moves. It also can't move it in two directions at once. It should either freeze because there are conflicting rules, or process it based on the first matching rule it encounters. Can you describe the symptom you're actually seeing (or are you just anticipating that it won't work)? (cont'd)
    – fixer1234
    Apr 13, 2019 at 9:48
  • In a situation like bob + helpdesk, you need to define where it is supposed to go in that case (it can go only one place). BTW, Thunderbird filters support multiple conditions right in the window where you define it. So it isn't clear exactly what the problem is.
    – fixer1234
    Apr 13, 2019 at 9:48
  • No, it moves it from Inbox to subfolder based on recipient, then to tertiary subfolder based on subject, then back to subfolder (up the hierarchy from current location), then when the filters run again it does it all again. I have had "infinite looping" but adding a "moved" tag seemed to stop that. I can't get the messages to stay in the tertiary subfolder Inbox > recipient > subject > senders, no matter what I've tried.
    – pbhj
    Apr 13, 2019 at 11:17
  • It would help if you add examples of the actual filters, the specs for what folders they're applied to, and the folder structure. It isn't clear how they're moving back to where they came from. You generally tell filters where to look and where to move to, so it isn't clear how this action could happen unless the filters are creating a loop (solution: don't do that).
    – fixer1234
    Apr 13, 2019 at 16:22
  • You've already invested 100 pts in a bounty and received 1 answer. Does that solve your problem? If not, you're limiting the ability of others to provide solutions by not providing the detail for people to understand what's happening.
    – fixer1234
    Apr 15, 2019 at 19:06

1 Answer 1


In my opinion you have these possible solutions:

  1. See if this is possible using the FiltaQuilla add-on (link to the Thunderbird Add-ons website).
  2. Create 50 (or 100) filters in Thunderbird.
  3. Create your own Thunderbird extension.
  4. Use another email client.

The FiltaQuilla add-on (link to the developer's website) is described as:

Adds many new mail filter actions - launch a file, suppress notification, remove star or tag, mark replied or unread, copy as "read", append text to subject.

If none of the ready-made filters in FiltaQuilla does exactly what you want, FiltaQuilla also supports JavaScript expressions, unlimited in complexity, that allow you to build your own filters, while having access to all the elements of the incoming message. This will in principle allow you to develop any filter you like, only requiring knowledge of JavaScript.

FiltaQuilla is no longer under active development, but is still reported as working.

If you wish to create your own Thunderbird extension using Mozilla JavaScript, these references will help to get you started:

  • I'm just looking at hacking msgFilters.dat directly, but it doesn't appear to be working as expected. I saw FiltaQuilta, it's a bit heavy going, I was hoping to avoid learning a new esoteric scripting system. Maybe an extension that creates a filter in msgFilters.dat to move all sender email to a specific directory would work ... thanks for the input. Still hoping someone has a more complete solution.
    – pbhj
    Apr 13, 2019 at 11:09
  • JavaScript is not just another language - it's the basis for the entire Web. It might be worth learning. There's an enormous amount of information about using it available when searching on the Web.
    – harrymc
    Apr 13, 2019 at 14:48
  • 1
    @pbhj: It seems like nobody could think of another solution.
    – harrymc
    Apr 20, 2019 at 6:11
  • Too late for your bounty.
    – harrymc
    Apr 21, 2019 at 18:20
  • Sorry I thought it had auto-awarded you the bounty ...?
    – pbhj
    Apr 21, 2019 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.