How do I synchronize Thunderbird tags with Gmail labels?

  • Brad Payne

    I have Thunderbird connecting to a Gmail account via IMAP, so Gmail labels show up as folders in Thunderbird. Moving items to folders in Thunderbird causes labels to be applied in Gmail.

    However, Thunderbird also has its own tagging mechanism where you can apply a color code and tag by pressing keys 1-5 on a message. Is there any way to propagate these tags to corresponding Gmail labels?

  • Answers
  • Ivo Flipse

    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.

  • TedPavlic

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

    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.

  • Russ

    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.

  • Related Question

    email - Importing Gmail labels in Mozilla Thunderbird
  • James

    I have recently setup Thunderbird to download all mails from my Gmail account.

    There are lot of emails in Gmail having labels.

    Is there a way to map Gmail labels to Thunderbird so that I can sort/filter by labels without having to manually re-tag them again in Thunderbird?

  • Related Answers
  • slhck

    See: Turn Thunderbird into the Ultimate Gmail IMAP Client.

    In your IMAP account settings, the Copies & Folders area, be sure to change the default location for Sent and Drafts to [Gmail]/Sent Mail and [Gmail]/Drafts respectively, as shown.

    Even after you do this, you'll notice a few strange labels in your Gmail account: [Imap]/Sent, [Imap]/Drafts and [Imap]/Trash. These are Thunderbird's default Sent, Drafts, and Trash folders. Once you make the change to your account settings, you can delete those labels in Gmail and they won't get regenerated. (Note: except for [Imap]/Trash, which I can't rid myself of entirely, since T-bird seems married to it. Bueller? Update: see the next section for the solution to the [Imap]/Trash label.)