Updated 12th March 2016: For folks landing here via search engines and the like, I recommend ditching Gmail as a mail service altogether – as I now have. The hoops one has to jump through to simply get Gmail to behave normally with an external mail client are no longer worth the effort in light of the better business email hosting services now available. FastMail in particular is a cinch to set up, is stable and affordable, and just simply works with minimal setup on the Thunderbird side. Google clearly has zero interest or business reason to permit Gmail to work seamlessly with external clients, especially as it removes the vector for targeted advertising.
Having said this, the below should still work well.
After throwing my toys out of the cot regarding Google’s attempts to shoehorn stupid features into their mail offering in an attempt to turn email into something it’s not, I thought I’d blog the settings I use in both the Gmail web interface and Thunderbird to get it behaving sanely over IMAP.
So, if you’d like to use Thunderbird with Gmail and be able to do the following:
- deal with a single copy of each mail item
- be able to sort that copy into a folder
- delete mail items and have them go into a Trash folder, which you can then empty
- just generally and basically have it work without it getting in the way…
Then read on! The good news is that once you’ve jumped through these hoops, Thunderbird makes a fabulous Gmail client, especially in combination with goodies like the QuickFolders add-on.
I am using Thunderbird 9.0 on OpenIndiana oi_151a (Note: still current as of Thunderbird 38 on Ubuntu 14.04), and a Google Apps account for my Gmail. I am assuming you have first already enabled IMAP support in Gmail, but have yet to create an IMAP connection to it in Thunderbird.
First, let’s prevent Gmail’s new, “special” folders from appearing in Thunderbird. This a) reduces a great deal of interface confusion for Thunderbird users, and b) prevents a duplicate copy of every single email from being created in Thunderbird thanks to the “All Mail” folder. Don’t think too hard about it, just log into the Gmail web interface, go to Settings -> Labels, and apply the settings as highlighted in the following:
Next, configure an IMAP connection to your Gmail account in Thunderbird. Once the account is visible in your client, make particular note of the set of folders visible under the funny-looking “[Gmail]” folder – it should look like the following:
Now let’s configure Thunderbird such that when you delete an email, it goes into the Gmail Trash folder, and from there if you empty the Trash folder, the message is permanently deleted. No, don’t ask why I am stating the bloody obvious, just observe the following settings for the Gmail account in Thunderbird (and note that this runs counter to the completely bizarre “recommended IMAP settings” Google would have you use). Make sure that the Trash folder you reference is the one that sits under the [Gmail] folder:
Test this by deleting a message from your Inbox or whatever – it should go into the [Gmail] -> Trash folder, and you should be able to right click on that folder and empty it to permanently delete items.
Disable Thunderbird’s junk email detection for the Gmail account (as we’re using Google’s existing spam filtering):
Finally, and this is referenced in Google’s documentation, if you are sending mail out through Google’s SMTP server, then make sure that you are not also saving a copy in the Sent Mail folder for the account. Again confusing, because this is naturally what you would want to do for an IMAP account – but as it happens Gmail will save a copy automatically in the [Gmail] -> Sent Mail folder if you use their outbound server (which I do). I use the following settings for copies of sent mail, and any other copies:
Update: To configure a mail sorting rule (known as a “Filter” in Gmail-speak…..) such that messages are sorted automatically into Thunderbird folders depending on conditions such as the recipient email address, it’s best to do this using the native Gmail web interface. In this way it’s a server-side rule – and when you set up Thunderbird on another computer or otherwise have to reinstall, you won’t have to reconfigure your mail rules all over again.
In Gmail, go to “Settings -> Filter -> Create a new filter”:
In the below example, we are simply creating a rule that will sort incoming mail addressed specifically to “firstname.lastname@example.org”:
In the next screen, ensure the setting marked “Skip the Inbox (Archive it)” is ticked – otherwise you will end up with mail double-ups in Thunderbird. Second, set the “Apply the label” setting to the desired destination Thunderbird folder – in this example, I have selected an existing folder named “Ekiga”. All other settings are left blank:
Once you have clicked “Create filter”, the rule is then in effect. You can test it by switching back to Thunderbird where new messages should be sorted automatically on arrival to the desired folder.