SEARCH

How-To Geek

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.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 11/29/07

Comments (51)

  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.

  22. vergie edwards

    i can not figure out to set thi up i am trying to set up my mozillathunderbird account and i can not get the pass word right i am trying to set it up with my dial up connection so please help me if you can

  23. pipo

    hi guys,

    in outlook (the email client we use in the office), i accidentally found an option where outlook can be minimized to the system tray, does thunderbird have something similar?

  24. Steven Miller

    I just have one question. If you choose NOT to have deleted messages go to the Gmail Trash folder, how do you get rid of them since they end up labeled as IMAP/Trash in the All Mail Folder. I supposed that eventually you could do a filter on them and move them to the Trash folder.

    Am I missing something?

  25. Joe Vautour

    I have a question. I recently jumped on the Thunderbird wagon and used IMAP for my personal Gmail account. Everythibng seems to be working ok. I have a second Gmail account for a group that I am in. Is it possible to set up two Gmail accounts IMAP in Thunderbird? WIll it keep the two accounts seperate? I would really like to know if this can be done. Great Blog by the way. I came across it a few weeks ago and love reading your articles.

    Joe

  26. carlo

    Joe, Yes it’s possible to setup two IMAP accounts but I think that is more conformatble to forward one Gmail address to the other and check only one IMAP account.

  27. Harry

    I have tried adding 2 gmail imap accounts to my thunderbird but after adding the 2nd it just doesn’t appear. Then when tryign to add it again it says it already exists?! Obv a bug?! Please help.

  28. Macca

    I also find it useful to have my Gmail contacts synced with Thunderbird.

    For that I use the Zindus Gmail contact sync addon. Works a treat.

  29. Scott

    Thanks!

  30. Kevin

    I have tried the customer settings for syncing TB trash with Gmail trash and none of them are working. It seems that this behavior has changed and no longer works. Does anyone have this working with TB still ?

    In the account settings what is the “When I delete a message” supposed to be set to ? I would imagine that this would be set to “Move it to the trash folder”. When I have this set and the edits done to the config for mail.server.server[x].trash_folder_name set to imap://[username]@imap.gmail.com/[Gmail]/Trash (which follows the format of other settings) it does not work. Every time I try this it puts the message in a [IMAP/Trash] folder on Gmail.

    Thanks for any help ..

  31. ScottW

    Kevin, it still works for me as I describe in my previous comment in April. The setting for “When I delete a message” should definitely be “move it to the trash folder”. You aren’t putting square brackets [] around your username, are you?

    I suggest anyone who needs help should ASK IN THE FORUM. You can’t have a good conversation in this comment section.

  32. Steve

    Scott W, I don’t have mail.server.serverX.trash_folder_name in which to put the imap://username@imap.gmail.com/[Gmail]/Trash
    Why? or where is it?

  33. ScottW

    Steve, you need to create this value as described in the main article under “Synchronizing the Thunderbird Trash…” where it shows how to select New -> String in the Config Editor.

  34. Steve

    Scott that worked and thank you for the fast response.

    My only problem now with Thunderbird is that all the Favorite folders don’t show (two out of 8 come up) in the folder pane when I bring Thunderbird up. Any ideas. I have to go to the pane and move up or down and then back to favorites and then all will show up in the pane again. If I don’t close TB 2.0.0.16 all is well.

    Thank you again…Steve

  35. Dave P

    Trying to make Thunderbird my new email program, stuck on “Enter your password for dave@imap.gmail.com” then “Login to server imap.gmail.com failed” messages. I’ve entered the only password options I’ve created just today with a new computer, freshly downloaded software, and neither get me past this point. I’ve sent several test messages from Thunderbird, they show up in google apps mailbox when I go there to see if the connection is working, but not in Thunderbird inbox, I’m guessing because of the above message. If the passwords I’m trying are not working, is there an option to change the password so it will work?

  36. The Geek

    @Dave

    I removed your phone number from the comment…

    You should leave your questions on our forum, not as as a comment here. http://www.howtogeek.com/forum/

  37. Tony

    Has anyone had this working on the latest thunderbird – 2.0.0.16?

    No matter what I set it stubbornly recreates [imap]/Trash and puts its trash there.

    user_pref(“mail.server.server2.hostname”, “imap.gmail.com”);
    user_pref(“mail.server.server2.trash_folder_name “, “imap://username@imap.gmail.com/[Google Mail]/Bin”);

    I’ve also tried
    [Google Mail]/Bin
    [Google Mail]/Trash
    [Gmail]/Bin
    [Gmail]/Trash
    Bin
    Trash

    etc.

    Nothing has *any* effect. I’m just about to copy an earlier version of TB I have on another machine that I know does support this option, but it would be nice to know why they removed it.

  38. Gerry

    Tony, remove the space from the end of the “mail.server.server2.trash_folder_name ” string. I just figured out that this what was making it not work for me.

  39. Spoonguard

    Gerry:

    Haha, no, that isn’t it.

    There seems to be more to defining a trash bin then what is in the config editor: it’s probably something stupid in the msf files. At one stage I had two trash containers.

    Having gmail’s language set to UK seems to make it this very difficult to accomplish, I don’t know why.

  40. Kevin

    THANK YOU! I have been scratching my head all day trying to figure out a way to *actually* delete something in T-bird with Gmail IMAP. Very surprised this isn’t in the official Gmail instructions.

  41. Rob

    Using this a deleting a inbox item, it deletes out of thunderbird fine.

    When I got to gmail interface and search for the email I deleted from thunderbird and it still shows up with no label.

    Whats wrong with this picture? I thought using this method deleted it permanently?

  42. Anonymous

    IMAP feature is very interesting, unfortunately the mob hotmail and Cie are so stingy, there is only Google, and its way of doing is too fancy. Its moto: Hey! with a new Google account who needs to delete a single message – Sure enough, we users need to read/archive AND DELETE

    My experience:

    mail.server.server[x].trash_folder_name – string: [Gmail]/Trash
    Did not work the first time. I did however the second time after re-creating my IMAP accounts from scratch. The trash folder was at the end of my Gmail folders before. After modifying the config. file and changing the account preferences: Mark it as delete >to> Move it to the trash folder; closing and re-opening Thunderbird, the Trash icon was relocated below the Spam folder. Selecting a message for deletion effectively sends it to the Gmail trash folder.
    In the web Gmail interface page, no [Gmail]/Trash label is created anymore. The message are just move to the Trash as it should be in its DEFAULT.

    mail.server.server[x].trash_folder_name – string: imap://[username]@imap.gmail.com/[Gmail]/Trash
    Did not work for me at the date of this comment.

    I am glad if my comment can help other and make you save some unnecessary time browsing the internet to solve a problem that should not be.

  43. Anonymous

    Edit: I am still testing this method and it seems there is a serious bug. When sending a message from a Gmail account with subject trash, message body text trash, to another Gmail account in Thunderbird, the message ends up directly in the trash folder.

    I would recommend filling a bug complaint to Gmail since it seems to be Gmail IMAP server related and not Thunderbird.

    Good luck

  44. Anonymous

    Edit (Last). Thunderbird with 3 IMAP Gmail accounts. 2 works, 1 forward directly all messages to the trash.

  45. Anonymous

    Edit (Last hopefully): Full accounts working now. Config > search string: Trash > deletion of 1 string imap://[username]@imap.gmail.com/[Gmail]/Trash (probably left over from a previous try), i.e. There were 2 entries for the account sending directly the received mails to the trash.

  46. Anonymous

    Edit (Conclusion): I have removed all accounts, deleted the .js file and restarted anew. As of the day of the comment, there is no need to modify anything. Just selecting Move to trash in the account preferences will move the message… to the Gmail trash folder.

    It did not work the fist time, so I have browsed the internet to find the solution aforementioned [Gmail]/Trash, but as of today, that is no necessary anymore. Sorry about the fuss. Enjoy you IMAP account as I do now.

  47. Oleg

    Hello,

    Could anybody, please, explain – I set up gmail account as IMAP (not gmail). It works fine, except deleting the emails. The mail will be deleted from Inbox, but there is another folder, called “All mails” (or something similar) – the message, which was deleted from Inbox is still in that folder.
    – So we need to delete each email several times, until it will be deleted everywhere? But this is MicroSoft’s approach to coplicate everything as much as possible, GOOGLE follows its big brother. It reminds me Griboyedov’s “WOE FROM WIT” comedy :)

    Thanks!

  48. Guy

    I spent a long time trying to get deleted emails in Thunderbird to move the emails to the trash folder in Gmail properly.

    I’m in the UK and Gmail, due to legal reasons, is known as Google Mail. I think this is why I could not get delete to function correctly.

    Here is what I had to change the “trash_folder_name” string to in order to achieve this:

    [Google Mail]/Bin

  49. Jim

    Google has fixed deleting email using T-bird with Gmail IMAP. In Gmail go to Settings/Labs/Advanced IMAP Controls and enable.

    Thanks to The Geek for the temporary work around. Thanks to Google for listening to their users.

    Cheers.

  50. Mathew

    IMAP will help you to synchronize existing emails in Gmail with Thunderbird. But how would you sync existing emails in thunderbird with that of gmail. i.e. i have been using thunderbird on my PC. it has a good amount of mails both in the local folders and also in existing account inbox. i want to backup those email into a new gmail account. How do i do that?

  51. Betsy R

    Now that Thunderbird version 3.0 is out, are there any changes to the instructions above?

Enter Your Email Here to Get Access for Free:

Go check your email!