After updating from Mozilla Thunderbird 1.5 to 2.0, I noticed that a manual filter that I had set up stopped working when I clicked the Run Now button. Today, I found a painless and effective workaround for it.
This problem occurs under the following conditions:
- The folder is on an IMAP server
- The mail filter contains one or more rules that match a custom header
- The filter is run manually by selecting “Run Filters on Folder” from the Tools menu or by going to the Message Filters dialog, selecting a folder from the “Run selected filters on” drop down list and then clicking the Run Now button
Note: Filtering on a custom header will work on incoming IMAP mail, just not when run manually on IMAP folders.
The reason the filter fails is that the filter functionality in Thunderbird 2.0 was changed to search the local cache instead of the server and the cache doesn’t contain custom header information, only the standard headers. This change was made because some IMAP servers either don’t have search capability or their implementation is broken.
So, in order to get the filter to work again, Thunderbird needs to have a local copy of all the message headers. Bug 184490, After-the-fact Filters on custom header (eg “User-Agent” or “Newsgroup”) won’t match for IMAP messages, documents this problem and David Bienvenu, in comment #50, gave a very nice workaround for it.
The workaround simply downloads all the messages with all the headers to the local repository for offline use. Hence, Thunderbird can now see all the custom headers and filter on them. To employ the workaround, simply do the following:
- Right-click on the folder you want to filter
- Select Properties
- Click on the Offline tab
- Select the “Select this folder for offline use” checkbox
- Click the Download Now button to make sure your local copy is up to date
- Click the OK button
Now, when you manually run your filter(s), they work! What a relief it was to find this.