Thursday, May 8, 2008

Importing / Exporting filters in Thunderbird 2.0, copying filters between folders

Thunderbird 2.0 has an annoying limitation of only being able to specify rules for folder roots and cannot apply these rules to other sets of folders. That would be less annoying if Thunderbird offered a way to move or copy rules between folder roots.

For example, I use IMAP to speak to our corporate Exchange server. I have a set of rules configured there. I also have "Local Folders" which contains my "Archive" folder, where I put all the IMAP emails I want to keep.

Sometimes I add a filter to the IMAP folders that I want to then process retroactively against my archive (i.e. to add a certain tag to be picked up in the Save Searches folders I have). Using just the Thunderbird interface I'd have to manually recreate this rule.

There are a few extensions on addons.mozilla.org for exporting and importing rules. I haven't had any success with these. I get errors that the folder doesn't exist or such.

You can fairly easily copy rules between folders by editing the underlying rules file. To do this:
  1. Find out your root folder locations. For each of the sets of folders you want to copy rules between, right-click the folder in Thunderbird and choose "Properties".
  2. Remember the location listed under "Local Directory".
  3. Close Thunderbird. If Thunderbird is open, any changes you make to the rules file appear to get overwritten as soon as you open the Filters window again
  4. Navigate to the locations from step 2.
  5. In each is a file called "msgFilterRules.dat". This is a plain text file. Make a backup copy, then open the original in your favorite text editor
  6. There is no explicit delimeters between rules, but for me a rule seems to always start with the line "name=" and end with the line "condition=". Just copy that block from one msgFilterRules.dat" file to the other.
  7. Launch Thunderbird and you should now see that rule in the Filters window.

2 comments:

Ray said...

This worked, thanks!
Ray Spence

Poltiser said...

Tx for a tip - it works!