How to export and import message filters of Thunderbird

I have several installation of Thunderbird under Linux to check/send emails using IMAP email servers. I use filters extensively to manage my emails. How to export and import message filters of Thunderbird so that I can synchronize the rules on several installations?

asked Mar 30, 2014 by Eric Z Ma (44,200 points)

2 Answers

 
Best answer

About message filters in Thunderbird (More at http://kb.mozillazine.org/Filters_(Thunderbird)):

Filters are account specific, there is no support for global filters.
The closest thing to a global filter would be to configure several POP
accounts to use a Global Inbox. In that case, you could create filters
for the Local Folders pseudo account that would be applied
automatically to incoming mail for those accounts.

Where the filter settings are stored?

The file that stores your filter settings is called "msgFilterRules.dat". Each account will have its own "msgFilterRules.dat" file, stored in the "Local Directory" for the account in your profile. The Local Directory is specified at the bottom of Tools -> Account Settings -> Server Settings, right by the Browse button. The filters for Local Folders are stored in the Mail\Local Folders directory in the profile.

How to backup/duplicate the filters?

If you want to duplicate an accounts filters in another account you don't need to create them again. Exit Thunderbird and copy the "msgFilterRules.dat" file instead. If the account is in another profile and it uses custom headers you will also need to copy the mailnews.customHeaders setting from prefs.js.

Remember to close Thunderbird before manually change these msgfilterRules.dat files. Otherwise, Thunderbird will overwrite your changes.

To quickly find all your filter setting files on Linux, run

find ~/.thunderbird/ -name msgFilterRules.dat

The msgFilterrules.dat is just plain text file. Edit it as you needed---usually just the directory paths for duplicating an account's filter to another account.

answered Mar 31, 2014 by Eric Z Ma (44,200 points)

Like you, I want to have one and only one mail filter set. This can be done, at least on Linux.

Go to the directory, /home/[username]/.thunderbird/[random].default/

sudo find / -iname "msgFilterRules.dat"

will show you all the filters as described by others. Pick whichever one you want to be the main one. I chose ./Mail/Local Folders/msgFilterRules.dat, which is the rule in the Local Folders directory that I don't otherwise use. Copy the one you want every account to use into this directory.

Go to each mail directory and enter the command:

ln -bsv ../../Mail/Local\ Folders/msgFilterRules.dat msgFilterRules.dat

This will backup the previous filter file, and create a soft link to the file in ./Mail/Local Folders. [Obviously you'll have to alter this if you want a different filter file to be your primary.]

In effect, every mail account will follow the softlink and load the same ruleset.

What I haven't checked yet is what happens if you choose to edit your filters in Thunderbird. Presumably the link would be wiped out. But as long as you have a copy of the final version of your filters, you can restore them easily enough.

answered Dec 22, 2017 by thomasmbrooks (140 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...