How To: Use Gmail over IMAP and tag your mail, too
- Create IMAP address, keep private: This is the address we'll use to forward all your Gmail to. It's best to get this set up right away as we'll need it pretty quickly down the road. Ideally, keep this address private, because no one should ever actually see it unless they go digging.
- Download all Gmail via POP: If you haven't already been doing this, you'll need to create a POP account to perform an initial download of all your mail, since Gmail only provides access via POP (one of the drawbacks that probably brought you to reading this how-to in the first place). Head over to Gmail's help section for exhaustive instructions on getting set up via POP, including plenty of guides written specifically for a wide variety of email clients across all OSes. Depending on how much Gmail you've already racked up, the actual downloading portion of this step might take a while, especially since Gmail seems to allow around 400-450 messages to be downloaded during each operation. Finish this step completely - downloading every last Gmail message - before moving on to the next step.
- Begin forwarding and disable the POP account: Immediately after you've finished downloading all your Gmail via POP, enable forwarding in your Gmail account and enter that IMAP account we created in step one. Depending on the volume of your email traffic, you'll want to be quick about this to ensure you don't miss any messages between your last POP download and when you flip the switch on forwarding to this new address. Just as quickly, you should either shut off automatic downloading of your Gmail POP account in your email client or simply disable POP access in Gmail's settings. I elected to shut off POP access in Gmail since the next step requires some shuffling of all that downloaded Gmail from your old 'n busted POP account to the new hotness IMAP account which we're about to set up.
- Add the IMAP account to your email client: This is where a couple of key incoming/outgoing server tricks come into play so you can transparently use your Gmail account over IMAP with a desktop client, but still maintain some of Gmail's cool features like the all-too-handy conversation view. As you might guess, begin entering the credentials for your secret Gmail IMAP account, but switch things up with two particular aspects of the account: the 'From' address (sometimes called a 'Reply-To' address) and the outgoing server through which you send your messages. One of the double-edged swords of email is that it's easy to make it look - at least superficially - like a message is coming from just about any address you want. While this is a trick that spammers use for evil, we'll be using it for good, ensuring that recipients of your messages don't get confused by your Gmail + IMAP trick: Instead of entering your secret IMAP address in the From/Reply To field, simply enter your actual Gmail address. This means that recipients of your email will see that it came from your Gmail address and not the IMAP account. While it is true that anyone can easily dig into the message headers to track down the IMAP account your messages are actually coming from, you shouldn't have to worry about this for the most part. As long as you aren't a spammer or otherwise misusing this trick, most people won't have any reason to go digging in the first place, and you'll be exchanging email transparently via your actual Gmail address.
- Set your outgoing server to Gmail, not your IMAP account: This is the final trick to maintaining optimum integration with Gmail, since using Google's servers to send all your email will ensure your sent messages and replies to conversations actually display in-line when viewing your Gmail in a browser. Gmail's SMTP server is smtp.gmail.com, and it requires authentication (your full Gmail address + password).
- Move over all your old mail: Now that you have all the IMAP setup out of the way, it's time to start moving over all your old Gmail from the POP account into your new IMAP account so it'll sync with email clients on your other computers. The time this takes is again dependent upon how much Gmail you actually have, but it basically involves moving/copying all your Gmail from the old POP inbox to the new IMAP one, as well as moving any folders you already set up under the old account into the new one. Since you could potentially upload a lot of email to your new IMAP server, this could take a lot of time. I had nearly 12K messages from Gmail when I did this, and between working on other projects and walking off to stretch my legs, it easily took a few hours, and possibly even half a day. Feel free to do this in batches if you can't afford all that time in one sitting, but the main point here is to move all your old POP Gmail into the new IMAP account so it will sync across all your computers and work well with the tagging system you'll set up in the next few steps.
- Install tagging plug-in, set up rules: If you don't already have MailTags installed in Apple Mail, grab it from indev.ca. It's a $20 plug-in but worth every penny, and as an added bonus, it can sync tags you apply to messages over just about every IMAP server by placing your tags in a custom X-MailTags header. This plug-in will also allow for more flexibility when organizing your messages into folders or, for example, when using Apple Mail's Smart Mailboxes to mirror your Gmail labels. MailTags even integrates with iCal, allowing you to easily create events and todos from your email, but that gets outside the scope of this how-to. For those not using Mail or even Mac OS X for that matter, I know of at least two alternatives: The cross-platform Thunderbird 2.0 has a tagging system that will sync over IMAP (and I believe, by extension, across OSes), and I found the Taglocity plug-in (thanks Chris!) for Outlook 2003/2007. While it should get the job done, note that Taglocity can't sync tags over IMAP just yet. With these plug-ins you should be able to sufficiently mimic your Gmail labels - MailTags allows you to search by tags (and even notes you add to messages), as well as filter your messages and even create Smart Mailboxes based on them. While creating these mailboxes and rules might be a little more work than using Gmail's "New Label" option, an open-ended tagging system that allows you to add tags on the fly can be a bit more flexible, depending on your workflow. This might take some tinkering with to find something that suits you, so be sure to discuss, ask questions and link other email clients and plug-ins that can help even more users make this leap from Gmail to IMAP.
- (optional) Install Mail Act-On: Another plug-in exclusive to Apple Mail from indev.ca (though Act-On is donationware, not commercial. At least not yet), but it's pretty fantastic: Act-On basically provides keyboard shortcut for managing messages. You can create a rule that automatically adds colored labels and (if you install MailTags as well) tags to messages, or even a rule that sends selected messages to a specific folder, and then simply use Act-On to add a keyboard shortcut to these rules. It's a pretty powerful management plug-in that will likely appeal to Gmail users who are addicted to Greasemonkey scripts like Macro.
- (required) Enjoy: If successful, you now have the best of both worlds: a Gmail account running over IMAP so you can use the power, integration and organizational synchronization of one or more desktop email clients, while also staying closely tied with Gmail should you ever want or need to check your email on the web and keep track of who said what and when. It might not have been an easy-breezy one-click journey, but this symbiotic setup should bring some relief to power users who find themselves caught between the online and desktop email worlds.
Catches, gotchas and other things to be aware of: Since this is essentially a workaround, it certainly isn't without its downsides. The primary catch with this setup is that, due to the need for forwarding your Gmail, your messages won't be marked read in Gmail online; the best you can do is set Gmail to archive your messages once they're forwarded, but if you plan on still using Gmail online with any frequency, this might add some complication to browsing your messages. Also, searching in most desktop email clients is far, far outshined by the power of Gmail's boolean search and its abilities to include specific phrases and exclude others in the same query. Unless I'm having an unusually hard time finding a specific message though, I have rarely found myself needing to hop over to Gmail online to really get the search done; possibly once or twice in the 4 months I've been using this setup. Finally, there's the commercial aspect to this trick: I don't know of an email or hosting service that offers IMAP for free, but to me, the advantages of having an email client that truly integrates with the rest of my OS far outshine the price I pay for DreamHost's services.
This guide should be enough to get you on your feet, but as always, feel free to discuss and ask questions in the comments. I've been using this setup exclusively alongside a few other IMAP accounts for 4 months now, and aside from a few Gmail perks that I've given up, I'm very happy with it. I hope you can be too.