Subscribe to How-To Geek

Recommended: Click Here to Run a Free Scan for Common PC Errors   [Sponsored Link]

Setting up Gmail IMAP Support in Thunderbird (1.5 or 2.x)

Gmail's IMAP support is one of the biggest things to hit the webmail world since, well, Gmail. We've already covered how to use imap from Outlook, and now it's time to show everybody how to use it from the open-source Mozilla Thunderbird email client.

The good news is that Thunderbird has much better support for IMAP than Outlook or most other clients, but there are still quite a few little tweaks that can be made to make it work even better.

If you haven't already enabled IMAP in Gmail, open up the settings page and choose Forwarding and POP/IMAP, and then select to Enable IMAP.

image

Update: These dialogs are from version 2.0 of Thunderbird, which natively supports Gmail as an option, but doesn't work for Gmail hosted apps accounts, so you need to follow a few more steps. If you are using regular Gmail you can use that option and skip down to "Synchronize Sent / Draft messages".

Open up Thunderbird and go to Tools \ Accounts Settings and click on the Add Account button. In the resulting wizard choose Email account.

image

Enter in your Name and your Gmail email address. You'll note that my email address is not @gmail.com, which is because I'm using the hosted Gmail Apps for your Domain.

image

On the next screen, choose IMAP, and then enter in the following:

  • Incoming Server: imap.gmail.com
  • Outgoing Server: smtp.gmail.com

Note: If you are outside of the US you may need to use imap.googlemail.com and smtp.googlemail.com instead of imap.gmail.com and smtp.gmail.com.

image

Enter in your Gmail email address here:

image

Click Next and then Finish, and you'll be returned to the Account Settings window, but we aren't done yet.

In the "Server Settings" dialog, you'll want to choose the SSL option, which should set the Port to 993 as well.

image

Choose "Outgoing Server" on the left hand pane, and then click the Edit button next to your Gmail account.

 image

Enter in the port number of 587, and choose the TLS radio button.

image

Your account should be configured now, but you should keep the Account Settings dialog open and keep reading for additional configuration options.

Synchronize Sent / Draft messages

To make sure that your sent mail or drafts in Thunderbird are available in Gmail, choose the "Copies & Folders" option on the left hand pane of Account Settings.

Very important note: If you are NOT using the Gmail SMTP server from the settings above, then you should check the box for "Place a copy in" and pick your Gmail sent mail folder under "Other". If you are using the default settings, the Gmail SMTP server will automatically place all sent mail into the correct folder in Gmail.

image

You do, however, want to keep the message drafts in the [Gmail] \ Drafts folder, which you can navigate from the popup menu as shown above.

Send Thunderbird Junk Mail to Gmail Spam Folder

If you want messages marked as junk in Thunderbird to get pushed to the Gmail spam folder, you'll need to choose the "Junk Settings" item on the left hand pane, and then check the box for "Move new junk messages to".

You'll want to select your Gmail account in the list, and then choose the [Gmail] \ Spam subfolder.

 image

At this point you should be able to delete the "Junk E-mail" folder/label, or wait until later and delete it.

Download Messages for Offline Use

If you'd like to use your account while offline, it would be wise to setup Thunderbird to download the whole message. Choose "Offline & Disk Space" in the left hand pane, and then check the box for "Make the messages in my Inbox available".

image

You can also select other folders / labels for offline use by clicking the box for "Select folders for offline use" and then choosing them in the dialog:

image

Important Note: If you've got 47 million emails in your Inbox, you really should think about whether you want to choose this option, because it's going to take forever to download.

You should be able to close the Account Settings dialog at this point. Once you click on the Gmail inbox you will be asked to login:

image

You can choose to store your password in Thunderbird's password manager if you'd like.

Once you've logged in successfully you should see all the Gmail folders:

image

Synchronizing the Thunderbird Trash with Gmail Trash

If you want messages deleted in Thunderbird to delete in Gmail you can use this more advanced hack to get it to work.

Important note: If you use this hack that means anytime you delete this message it will be gone completely, even if you had the message in two separate folders, because it's only a single message on the Gmail side.

If you want to do it anyway, go to Tools \ Options

 image

Choose the Advanced tab/button and click on Config Editor.

 image

Now you'll have to do some sleuthing to figure out what the "number" of your Gmail account is. Filter by mail.server.server and then scroll down until you see your IMAP account in the list, and then note whether the keys start with "mail.server.server2″ or some other number.

image

Right-click anywhere in the listbox and choose New \ String

image

Now you'll need to enter the following preference name, adjusting the "2″ if your number is different:

mail.server.server2.trash_folder_name

image

Enter in the following as the string value:

[Gmail]/Trash

image

Now you'll need to restart Thunderbird for the change to take effect. You can also now go into Gmail and remove the unneeded labels by clicking the Edit Labels link:

image

If you've followed everything so far, you can remove the [Imap]/Trash label as well as the Junk E-mail label.

image

Note that you'll have to restart Thunderbird yet again for that change to show up.

Creating New Folders / Labels

When you create labels in Gmail they will show up as folders, and creating folders in Thunderbird will show up as labels on the Gmail side:

image

You can even create subfolders…

image

Which will show up in Gmail as ParentLabel/ChildLabel

image

You can create a subfolder in Gmail by using the same syntax with a forward slash between parent label and child label:

image

This will now show up in Thunderbird the next time you open the application:

image 

Deleting Folders in Thunderbird

You can certainly delete them if you choose to:

image

But you'll end up with a new label with a weird name in Gmail:

image

You'll have to delete them from the [Gmail]/Trash folder in Thunderbird as well to avoid doing it in Gmail.

 image

Starring Messages

This is so simple it's barely worth mentioning… but you star a message in either Thunderbird or Gmail and it will sync across the two:

image

Working Offline

To work in Offline mode, you can choose File \ Offline \ Work Offline from the menu…

image

Or you can just click the little icon in the bottom left hand corner.

image

You'll be prompted to download the messages for offline use, which will download from the folders we specified earlier in this article.

image

Automatically Check for New Email in Folders Other than Inbox

Unfortunately Thunderbird by default doesn't check for new email in any folders other than the Inbox, so if you are using filters and labels you might want to change this by going to the properties of a Folder / Label:

image

Now just choose the "Check this folder for new messages" option.

image

Unfortunately you'll have to do this for all the folders/labels, but it's good to know.

Are We Really Done?

That covers most of what you need to know, so thus ends one of the longest pages I've written.

For more usage tips and a lot of helpful comments, you might want to check out the Lifehacker article on this subject.

The Geek is the founder of How-To Geek and a geek enthusiast. When he's not coming up with great how-to articles, he's probably writing at his personal blog. This article was written on 11/29/07 and tagged with: Firefox & Internet

Comments (21)

  1. jambarama

    Maybe this is just because I'm a heavy gmail user and labeller, but maybe its more universal. Does anyone else find loading folders/labels intolerably slow each time you click on it? I went to my "transactions" label, it took a full 90 seconds to load. Then I clicked on my inbox accidentally, so I had to wait another, nearly 90 seconds, to reload "transactions" label. It seemed to be just as slow on Thunderbird as Kmail (don't have outlook to test). Does any mail client cache mail sufficiently well to make load times not obscenely long?

  2. Jared

    Rather than mapping Thunderbird's Trash folder to Gmail's trash, I have it mapped to [All Mail] - when I "delete" a message in Thunderbird, this moves the email to the "All Mail" folder in Gmail - effectively archiving it. If Gmail's going to give me all of this storage, I'm going to make use of it :D

  3. Jared

    @jambarama:

    Mine's the same way - it seems the email clients don't cache the messages, so they have to load each time.

  4. The Geek

    Personally I stick with good old reliable POP access for my desktop email client.. there's never any speed issues, and anytime I'm not at my computer I can still check Gmail from anywhere else.

    Both Outlook and Kmail are extremely slow using Gmail IMAP. Thunderbird is a little faster for me.

  5. Ben

    This is great! I've never been able to send emails through a desktop client (I've been able to recieve them but only send through web-based clients) Now I can send them for some odd reason.

  6. jeff ruday

    Hello - We have communicated offline re this subject. I just read this excellent article and wondered if in writing it you had the opportunity to try the reverse. Using data in the local TB folders to populate a new Gmail account. I have just registered for a Google Apps account and would LOVE to be able to populate and my new Google Apps Gmail account with all of the mail in my regular Gmail account and preserve the labels and filters. I am happy to do a test but I am not sure *exactly* of all the steps. I would be grateful if you would send me what you think are the specific steps to do this. I promise to send you a full report. Thank you.

  7. Daniel Spiewak

    @jeff

    My off-hand suggestion: setup and IMAP account for the new Gmail account in Thunderbird, make sure you have a *separate* IMAP or POP3 account for the other Gmail account, Ctrl+A, Ctrl+C in each folder, Ctrl+V into the corresponding folder in the new account. Should do the trick!

  8. jeff ruday

    Hello Daniel - Possible for me to e-mail you direct regarding this matter. Thanks
    Jeff Ruday - 12-2-07, 09:15 PM

  9. James Patterson

    Good stuff.

    Might be worth adding to the guide the fact that you must have your Gmail account Language set to 'English (US)' to enable the option to have IMAP. If it's anything else (I was English (UK)), it doesn't give you the option of IMAP.

    Silly Google.

  10. Toby

    Jeff

    The only issue I found with the "ctrl-a, ctrl-c, ctrl-v" method when transferring my email into my new Gmail/GoogleApps inbox was to do with dates of emails.

    When in Thunderbird the dates of the received emails were right. But Gmail webmail ignores the "real" date of the email and displays the date and time of when I copied my email over, meaning I have thousands of email received on one day! Minor for me since I rarely use webmail, but even so I'd like to be able to control this from within Gmail (and I haven't seen a way of controlling this behaviour yet). Can't see any way round it either if Gmail is going to force this display behaviour on me.

  11. Alison Wolstenholme

    Our Gmail account homepage has somehow changed to a foreign language (not sure which), as has our googlemaps homepage. We cannot figure out why as the Google homepage is in English (have checked the language setting).
    We want to know how to change the language setting for both homepages back to English (as default setting) since we cannot read the sites (as in foreign language), so we can use these sites.
    Any help greatly appreciated.

  12. Allan

    Very helpful, thanks.
    I have Thunderbird checking a Gmail account and 3 pop accounts. The problem I have is with the junk folder in Thunderbird. Sometimes messages get there by mistake and it can take a minute or more to move them or view them. Just selecting all the junk to trash it can take a minute plus! When I do this I hear my hard drive working overtime, like the messages are being uncompressed or something.

    Is there anything to be done about it?

  13. Allan

    I answered that one for myself. All I had to do was compact folders. I didn't realize it wasn't happening automatically. Once compacted slow junk mail cleared up.

  14. Henrik Gemal

    To check all imap folders for new mail, just set the option mail.check_all_imap_folders_for_new to true. This can be done in the Config Editor available in Tools -> Advanced -> General -> Config Editor…

  15. Mickey

    Very good description !

    However you don't describe how to configure the "when I delete a message" server setting.

    Some ones recommend to set it to "move it to the trash folder", others to set it to "mark it as deleted".

    What is your opinion ?

  16. Chris

    If you live in the uk & have a googlemail account (because ya cant get gmail accounts in the uk btw) the "trash" or deleted folder as we would say :) should be [Google Mail]/Trash for the string value!

  17. Mark

    when i delete the message from the inbox in thunderbird, is there a way to have it removed from the inbox, but remain in all mesages?

    cheers for the tutorial. great work!

  18. Chris

    I have found the trash part no longer work, has any else found this?

  19. Frank

    Chris, I find that too. I think Google has done something on their end (the same way they automatically copy all messages sent through smtp to your sent folder - whether you tell your client to or not). You can still drag the message to the [Gmail]/Trash folder and that works but it's not the same. I found this thread looking for a solution to Google's "fix".

  20. Scott W

    I figured out how to get deleted messages sent to the Trash folder on Gmail. For the value of the key, mail.server.serverX.trash_folder_name, I use this syntax:

    imap://username@imap.gmail.com/[Gmail]/Trash

    where username is your gmail name. I got the idea by looking at the format used to specify other folders in the advanced config editor.

    Geek: another great tutorial, thanks. You might want to update the section on synching the Trash folders, since it seems to have changed.

  21. Phil Spitler

    This is a great article thanks.

    I have set my filters up in gmail and it created my folders in Thunderbird as expected.

    My issue is that it copies messages to the correct folders but I would prefer it to move them instead.

    As it is I get the messages in the correct folder and the inbox too.

    I'm sure I could set up the filter in Thunderbird instead but it would be great to have it done by gmail.

    Any ideas?

    Cheers.


Leave a Comment




Leave your friendly comment here. If you have a computer help question, leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Copyright © 2006-2008 HowToGeek.com. All Rights Reserved.