Customize Saved Searches in Thunderbird

I use Mozilla Thunderbird exclusively as my email client. One feature Thunderbird offers is Saved Searchs. I use it to create a virtual folder “Unread Mail” that shows all my unread mail that is not junk. To do this I have selected the options “Status isn’t Read” AND “Junk Status isn’t Junk”.

My main use for this folder is to keep mail I haven’t handled yet in view. I mark these mails as unread and take care of them later. Now and then I mark some mails as unread by mistake and they disappear from my virtual folder, which isn’t very good. To fix this I decided to mark all mails I want to keep as starred. Then I wanted to change my virtual folder so that it displays mail that match (“Status isn’t Read” OR “Status is Flagged”) AND “Junk Status isn’t Junk”. This is not possible in Thunderbird’s interface, though. You can only select “Match any of the following” or “Match all of the following”.

I looked around a little in the configuration files (I found them in $HOME/.thunderbird) and found a file virtualFolders.dat! And by simply setting the terms property to the correct value solved my problem, like this:

terms=AND (junk status,isn’t,2) AND (status,isn’t,read) OR (status,is,flagged)

If you want to try something like this, remember to close Thunderbird before you edit the file. And make a backup of virtualFolders.dat first!


When I tried to repeat this on my computer at work, I failed at first. The best way seems to be to create a saved search folder from within Thunderbird that matches the one you want to end up with as much as possible. In my case I made one that matched my desired terms with the exception that the OR was an AND (“Match all of the following”) and then I simply changed that AND to an OR in virtualFolders.dat.