Turn Thunderbird into the Ultimate Gmail IMAP Client

Turn Thunderbird into the Ultimate Gmail IMAP Client

Gmail’s IMAP support roll-out this week had nerds all atwitter about the possibility of synchronised email access across devices, computers, and clients. IMAP is far superior to regular old POP for fetching your messages and maintaining your folder list whether you’re on your iPhone, office or home computer. If IMAP’s got you curious but you’re not sure what desktop application to use with Gmail, consider the extensible, fast, cross-platform and free Mozilla Thunderbird, our beloved Firefox’s little sibling. Here’s how to get the full Gmail experience in Thunderbird with IMAP.

What’s IMAP?

Internet Message Access Protocol (Wikipedia page) enables email programs to read messages stored on the server. Unlike POP, with IMAP it’s as if you’re browsing a network drive of files on a remote server with an open, live connection to that server; whenever you open a folder or view a message, it’s displayed from that server live. IMAP maintains a constant connection with your server and updates real-time.

Why is IMAP better than POP?

POP downloads and copies new messages to your local inbox. With POP you can download once and disconnect from the server, which is its one advantage. But you cannot download messages that have already been archived and labelled in Gmail via POP, and your client has to poll the server to get new messages. With POP access, if you move a message to a folder or star it in your desktop client, that change is not reflected in Gmail and your messages get out of sync. Any rules or mail filters you set up on one machine with a POP client have to be set up and reprocessed with a fresh download on all your other machines.

Think of POP as copying files from a server to your computer and working with them on your hard drive. Think of IMAP as connecting to a remote server and working with the files saved there.

Why Thunderbird (and not Mail or Outlook)?

We’re naturally biased towards open source software here at Lifehacker, but there are good reasons why Thunderbird is the best desktop client choice out there for Gmail IMAP access:

Set up Thunderbird correctly for Gmail IMAP

First things first. Once you’re fetching your email via IMAP with Thunderbird (here’s Google’s tutorial on how to do that), there are two settings you’ll want to set manually: specifically, where Thunderbird should store sent messages and drafts. 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.


tbird%5BImap%5Dfolders.pngEven 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.)

Set Thunderbird to use Gmail’s Trash folder (UPDATE)

Reader Vanl explains how to set T-bird’s trash folder correctly, which involves some Thunderbird configuration editing. Here’s how:

  1. From the Tools menu, choose Options.
  2. Go to the “Advanced” Option menu and the “General” tab. Hit the “Config Editor” button next to the “Advanced Configuration” label.
  3. Now you need to look around in there a bit to find which server you need to modify. Using the filter entry box at the top, type in mail.server.server and you will see a list of keys and values. One of those keys will be mail.server.serverX.name, where X is a number and the value is the name of your Gmail IMAP account. Remember X.
  4. Right-click somewhere in the box and select New->String.
  5. A dialog box will pop up asking for the name of your new key. Put in mail.server.serverX.trash_folder_name, where X is the number you remember from above. (For example, mine is mail.server.server2.trash_folder_name.)
  6. A new box will come up asking for the value of your new key. Put in [Gmail] /Trash.tbirdconfig.png
  7. Go to Gmail’s web interface and delete the label [Imap] /Trash.
  8. Restart Thunderbird.

Thanks Vanl!

How Thunderbird actions map to Gmail

Before we move into Thunderbird tweaks and add-ons, check out this chart of what actions in your client will do in web-based Gmail, courtesy of Google.


Note that Gmail labels do NOT map to Thunderbird’s tags. Each label is represented by an old school folder in Thunderbird. If a message has more than one label, it will appear in multiple folders, which is very cool. To label a message in Thunderbird, move it to the appropriate folder. To create a new label in Gmail, create a new folder in Thunderbird, and so forth.

Subfolders and Slash Labels

If you move a message into a subfolder of a folder in Thunderbird, over in web-based Gmail you’ll see a label named parent folder/child folder. Conversely, any labels with forward slashes in them will create subfolders in T-bird. You Folders4Gmail users in Better Gmail may absolutely love this. (Note: the Folders4Gmail script has been updated to support the IMAP forward slash as well as a backslash; Better Gmail to follow very soon. Thanks, Sean!)

Combine Gmail’s Spam-killer with Thunderbird’s Adaptive Junk Filter

Along the same lines as setting the Sent and Drafts folders to align above, if you enable Thunderbird’s Junk filter, make sure it moves junk mail to Gmail’s Spam folder so that Gmail marks it as spam as well. That way the bird’s adapative filter can teach Gmail as it learns. Here’s that setting:


Get Gmail Goodness in Thunderbird

Thunderbird has a few features built-in or easily added that are similar or match Gmail web-based functionality in a rich desktop app. Like:

  • Threaded conversation view. Ok, so it’s quite as nice as Gmail’s web-based implementation, but you can view messages by thread. Click on the tiny “display message threads” button to see replies in a hierarchical order in Thunderbird, as shown:

    Collapse the thread by hitting the – sign, and new replies to a message won’t create a whole new line in the list.

  • Gmail search operators and keyboard shortcuts. The GMailUI Thunderbird extension adds Gmail keyboard shortcuts (like y to archive, j/k to move up and down the message list), and Gmail advanced search operators to Thunderbird’s search box (like subject:hi from:gidget.)

    Set the y key to move messages to your [Gmail] /All Mail folder, which will archive messages in Gmail.


    There are other Thunderbird keyboard shortcut extensions (I’m also partial to TB Quick Move) but nothing as elegant as Gmail Macros on the web side for you Greasemonkey or Better Gmail users. Let us know if you’ve got a better alternative.

Enjoy Thunderbird-Specific Features

Getting your Gmail in Thunderbird via IMAP means you get T-bird-specific happiness too, like:

  • Sorting messages by size. Anyone who’s had a nearly-full Gmail account knows the tedious, manual process that is freeing up space. In Thunderbird, you can do the one thing Google wouldn’t let you do in Gmail: Sort your messages by size, so you can target the space hogs. To do so, hit the small button on the right-most side of the column header list, and select Size to show message sizes. Then click the Size header to sort ascending or descending, and delete the hefty messages directly from Thunderbird. Thanks, Vsack!
  • Drag and drop message import. Want to bring old email from other accounts into Gmail? While connected via IMAP, drag other messages stored in Thunderbird to your Gmail folders, for instant import with all the old message headers intact. Much better than the other convoluted methods we’ve recommended in the past. Thanks, Irian!
  • Reply before or after the quote. You need a Firefox extension like Better Gmail to do this in web-based Gmail, but in Thunderbird you can easily set whether you want your replies to appear above or below quoted text, as shown in your account preferences:

    You can also automatically select the entire quote for easy chopping up in your reply, and set whether your signature appears above or below your quote.

  • Better multiple identity and signature management. Set up multiple “identities” in Thunderbird with email address-specific signatures, which you can’t do in web-based Gmail. Hit the “Manage Identities” button in your Account Preferences dialog. The various identities you choose will be available as a dropdown in the From: field in new messages, just like in web-based Gmail. You can also create and automatically attach a vCard to your outgoing messages on a per-identity basis with T-bird, and choose to compose your messages as HTML or plain text per identity, too. (Click to enlarge screenshots of the identity manager.)
  • Better filters. Gmail’s filtering mechanism and interface is OK, but Thunderbird’s is better. Case in point: you can specify in what order filters should be applied to incoming messages. Check out our essential email filters for ideas.
  • Manage form letters with the QuickText extension. Easily send canned responses that contain message-specific variables like sender name with the excellent QuickText Thunderbird extension. Here’s how to knock down repetitive email with Thunderbird and QuickText.

I’ve only had limited time with the amazing combination of IMAP, Gmail, and Thunderbird, so I’m sure I missed some things here. How are you using T-bird/Gmail/IMAP? Let us know in the comments.

And for more ways to enhance Thunderbird, check out our previously posted eight killer Thunderbird extensions.

Gina Trapani, the editor of Lifehacker, is thrilled to have the Holy Email Trinity of Thunderbird, IMAP and Gmail together at last. Her weekly feature, Geek to Live, appears every Saturday on Lifehacker AU.


  • Sorry but the way The Gmail Imap and Thunderbird trash deletes work is impossible.

    see this completely unhelpful help


    which I came to from http://groups.google.com/group/Gmail-POP-and-Forwarding/browse_thread/thread/9f0ed59ece19741a/c31df89344a5fdcd?lnk=gst&q=thunderbird+trash+imap#c31df89344a5fdcd

    on which I have just posted My Method
    A normal Thunderbird delete puts in the account Trash (not the Gmail/
    Trash). the web item is labelled imap/trash
    Empty the trash and disappears from TB but web still there now without
    try the Remove immediately or Mark as Delete and nothing gained.

    Delete on web and it appears in TB Gmail/trash and then a web empty
    trash will remove completely

    So all I can see is Delete and Put into account/Trash in TB and the
    web will have a Imap/Trash label.
    Goto web on left menu select Label Imap/Trash and then Select All and
    Delete and then go to web Trash and Select All and Delete Forever and
    all disappears from Web and TB

    I notice that Gmail setup for TB shows a blank on the TB box Delete on
    exit – and that indicates they must mean this way of operating. And
    also never click Empty Trash in TB on Imap accounts.

    Perhaps to avoid that create a Trashfuture folder in TB and use that
    Label on Gmail for the Delete routine – which may stop an Empty trash
    Thanks for all the clues

  • you say “If a message has more than one label, it will appear in multiple folders” adding “which is cool”

    but for me, all mail is now in at least two of allmail, inbox, and a label.

    As i was using google labels as tags, mails are often in several folder. this is really really slow, and painful also: as deleting an email just removes one label from it.

    I have reverted to zero gmail labels, and just let spotlight and google search sort out the good from the bad on fly.


  • One key feature that I and others have been looking for that IMAP doesn’t give you is access to your GMail contacts. Well it turns out that Lifehacker has already given us the answer! After a few minutes of searching around I found that it’s possible by using a combination of GCALDaemon and the Contacts Sidebar Add-On to use and see all of your GMail contacts in Thunderbird.

    Install and set up GCALDaemon (just remember to ‘install’ and ‘start’ the service – that had me stumped for a while!). This gives you the ability to search for contacts when creating new emails. Enter ‘*’ (without quotes) into the contacts search box and you’ll get a full list.

    Add the Contacts Sidebar Add-On though and its default setup will automatically download your Gmail Contacts for you to view whenever you want (as long as you’re online).

    GCALDaemon: http://tinyurl.com/336kln
    Contacts Sidebar: http://tinyurl.com/2b9why

  • Umm instead of using the configuration editor to use the trash folder. Just add “[Gmail]” to your “IMAP server directory” under the Advanced Account Settings for the Gmail account Server settings.

    Instructions are as follows
    1) Choose tools then Account Settings
    2) Select the Gmail account and choose “Server Settings”
    3) In the Server Settings section choose the “Advanced” button
    4) Add “[Gmail]” in “IMAP server directory” (without the quotes of course)
    5) Choose OK and OK again.
    6) You then may need to delete the label create by thunderbird in gmail.

  • Excellent article. A little outdated, almost three years… is a long time.

    I firstly configured, last year, my Gmail account with the POP protocol.
    Last week (last friday) I realized I should be using the IMAP protocol. Then thought “OK, migrate won’t be a problem”… I was wrong.

    Well, now I resolve almost all problems and your guide gave me some ideas.

Log in to comment on this story!