Sunday, October 28, 2007

Using Gmail and IMAP

Google has finally implemented the IMAP protocol for Gmail. This is very good news for people like me who use an email client like Outlook most of the time from home or office but want access to their email elsewhere. IMAP lets you do this and keep all of your read, sent, and deleted messages in sync along with folders that you can create on either your email client or as labels in the Gmail web interface.

I (and Google) recommend using IMAP instead of POP for anyone who accesses their Gmail through an email client like Outlook. In this post I'll try to explain what IMAP does for you and how it works with Gmail in particular since Gmail does things a little bit different than other internet based email systems.

Get Started
Once Google has made IMAP available on your account, you'll need to enable it; unless you already have POP enabled, in which case IMAP will be automatically enabled. To enable IMAP, log into your Gmail account and click on Settings. In the main menu bar at the top you will see an item titled Forwarding and POP/IMAP (this bar used to be titled just Forwarding and POP). On that tab, you'll find the IMAP Access section where you can enable IMAP.

Next, you'll need to create an account on your email client. Google has excellent directions for this which you can get to by clicking the Configuration instructions link. Once you have your account set up (properly) and do a Send/Receive you'll get all of your Gmail into your email client.

How Gmail implements IMAP
Gmail is different from most other Internet based email systems in that it does not natively use the concept of folders. Most Internet based and client email systems use folders to let you organize your messages. Each message can exist in only one folder. You could, of course, make copies of your messages in other folders but this is a hassle and is generally not a good idea.

Instead, Gmail uses the idea of labels. This has nothing to do with IMAP, Gmail has always used labels. A label (or tag) is a piece of text that helps identify or categorize a message. A particular message may have many labels applied to it. For example, if you have a message from your uncle who is a dentist, you might apply the labels "Family" and "Doctors". Then whenever you looked at all messages from "Family" or from "Doctors", you would see the message from your uncle.

IMAP uses the traditional idea of folders; meaning that a particular message can belong to only one folder. So, how does Gmail IMAP resolve the folder vs. label dillema? Simple, Gmail makes copies if a message has more than one label (actually, it makes copies even if only one or no labels are applied). So, for the example of the message from your dentist uncle, your email client will have a folder called "Doctors" and another one called "Family" and your email will appear in both folders in your client email program.

The figure below shows that all of the Gmail labels are mapped to folders in an Outlook IMAP account.

In Gmail, all of the emails that you have not deleted will show up when you click on All Mail. In Gmail, Inbox is just a label that is applied to every message when it comes in. To remove the Inbox label, select the message and click the Archive button.

What happens if.... delete a message from a folder in your IMAP client program?
A: The corresponding label is removed from the message in Gmail. It will still show up in your inbox (if it was there) and in All Mail and in any other folders that correspond to labels that have not been removed. remove a label from a message in Gmail?
A: It disappears from the corresponding folder in your IMAP client program but it's still in any other folders that correspond to labels that have not been removed.

... you create/remove a folder in your IMAP client program?
A: A new label is created/removed in Gmail

... you create/remove a new label in Gmail?
A: A new folder is created/removed in your IMAP client program.

Starting to get it?

What happens if you send an email through your IMAP client program? Is is saved in Sent Mail?
A: Yes, it's saved in the Sent Mail folder in your IMAP client and it gets the Sent Mail label in Gmail. If the message was a response to an incoming message and you didn't change the subject line (except for the RE: that was prepended), then you'll see the message in a Conversation in Gmail. A Conversation is just a way of grouping messages (both sent and received) that have similar subject lines so that you can see a whole conversation at once. Outlook and some other email clients let you group messages by Conversation as well but it's enabled by default in Gmail so you're more likely to see it there.

Comments welcome.