How do I synchronize Thunderbird tags with Gmail labels?

It seems more people wanted this feature, but you should realize Thunderbird's folders are Gmail labels. Therefore Thunderbird's tags are not the same as the labels, in other words: there is no Gmail counterpart.

So as of yet I don't think this feature is available. I will check to see if I can find a way to filter your inbox for tags (moving them into folders).


From the Thunderbird Knowledge Base on filters

Filtering based on Tags

Thunderbird doesn't have explicit support for filtering by tags but you can select Custom Headers from the leftmost list box while editing the filter rule and add support for X-Mozilla-Keys, and then test whether it "contains" that tag. Thunderbird uses that header to store tags. For example, X-Mozilla-Keys: forum fyi indicates the message has the forum and fyi tags.

IMAP accounts store tags using message attributes instead, so its not possible to do that with messages stored in remote folders. If you copy the message to a local folder it currently doesn't add a X-Mozilla-Keys header with the tags, though it will add a empty X-Mozilla-Keys header when you compact it

Here's a link to the Knowledge Base on tags

Thunderbird has limited support for tags in message filters. It just supports set a tag as a action. However, if you add a custom header for the tag, or specify it using "Customize" in the leftmost list box you can test for tags. Since you can have multiple tags for a message its recommended you test whether X-Mozilla-Keys: "contains" a tag rather than using "is".

View -> Sort by -> Tags can sort the messages in a folder based on the tag. View -> Messages -> Tags can be used to display just the messages with the selected tag. The View list box has a similar menu command but it is not visible in the toolbar in version 2.x. Right click on the toolbar, drag and drop the View control to the toolbar, and press OK to add it. You can also create a custom view using View -> Messages -> Customize that displays just the messages with the desired tags.


In principle, it really could be done. See the IMAP extensions that Google added for their servers:

http://code.google.com/apis/gmail/imap/

If Mozilla would use these extensions, you could pull the GMail labels down and apply them to a message as tags. You can then use the popular "Conversation view" addon to essentially get GMail's web interface without the web interface.


I was also looking for a way to syncronize gmail labels and thunderbird tags.
I (sortof) found a way ...
The gmail label to a message gets applied from my imap gmail filter. And I create an like-named tag in Thunderbird.

  • In gmail in a browser: Settings >> Filters >> Create a new Filter:
    eg: Matches: subject:([nbusers])
    Do this: Skip Inbox, Apply label "[Gmail]/nbusers"

  • In Thunderbird:

    1. Create a new Tag with the same name as the gmail label.
    2. Tools >> Message Filters >> Select from "Filters for:" dropdown box >> New...
      Add your criteria (eg: Subject contains [nbusers])
      Add your actions (eg: "Tag Message", and select the new tag you created.)
    3. To apply to existing messages, in the "Message Filters" window,
      Highlight your new filter,
      Select the gmail folder in the "Run selected filter(s) on" dropdown box at the bottom of the window
      (eg: [gmail/nbusers]), and
      Click the "Run Now" button.

I said "sortof" above, because it's not really synchronized in an automatic sense. You've got to set it up in both tools.

An update: I tried the mozilla-x-keys method for my thunderbird filter. It didn't work.
Also in my above example, my gmail filter has "skip inbox". This negates the thunderbird filter. It causes the thunderbird filter to not see the incoming message and so it doesn't act on it. It works if you take off the "skip inbox" criteria.