John writes: How can I get Mail.app to work over IMAP with Gmail without duplicating all my messages with the “All Mail” IMAP folder.
Hi John — Indeed, Gmail is a great (and free!) solution, but the translation from Gmail’s “labels, not folders” gestalt to IMAP’s “folders are what we know!” has some quirks, for sure. First, it’s important to note that, accessed via IMAP, all of Gmail’s labels come across as folders. And since Gmail allows you to have multiple labels per message, that means the same message can easily be duplicated in multiple folders. If you’re going to regularly access Gmail via IMAP, you need to make sure you manage your mail such that this doesn’t happen.
Even if you do that, though, there’s still one folder into which all of your mail will be duplicated, the one named “All Mail”. Thankfully, Google gives us a path to keep the “All Mail” folder (and others, if you so choose) from appearing on your IMAP clients.
Note: While we reference Gmail throughout, it’s important to note that all of this will work with your Google Apps for Domains email accounts, too. It’s all the same backend regardless.
Configure Advanced IMAP Features
- [NOTE: As of May 31, 2011, this step is no longer necessary since Google now automatically integrates Advanced IMAP Controls for all users. We’re leaving this step here for consistency in case previous visitors come back or are referencing specific step numbers. For everyone else, just skip to step 2 below!]. In Gmail, go to Settings > Labs and and click “Enable” next to “Advanced IMAP Controls”, then click “Save Changes”. Now that you’ve enabled at least one thing from the “Labs” you’ll see a little green erlenmeyer flask next to your email address at the top.
- Still in Gmail, go to Settings > Forwarding and POP/IMAP
- In the “IMAP Access” section, ensure the following options are set: Enable IMAP, Immediate expunge messages when I mark them deleted in IMAP, Archive the message, Do not limit the number of messages in an IMAP Folder.
- Once set, click “Save Changes”.
Disable All Mail from IMAP
- Go back to Settings > Labels and you should now see a “Show in IMAP” column next to all your labels. It’s here that you’ll choose which labels you wish to hide from IMAP clients. At the very least, uncheck this for “All Mail”. It will save these settings automatically.
Configure Gmail On Your Mail Clients
Now you can setup your mail clients, including your Mac and your iPhone. On all of them, do NOT choose a “Gmail” preset. Instead, set them all up as standard IMAP accounts. Trust us, it’ll work better.
- For the Incoming Mail Server, use “imap.gmail.com”, allow SSL, and use port 993 (the last two will likely happen automatically).
- For outgoing mail, use “smtp.gmail.com”, allow SSL, and port 465.
Assign Your Mailboxes
IMAP allows you to not only sync up your inbox, but your Sent and Trash, as well. It also lets you sync up a Drafts mailbox, though experience has shown that this causes lots of duplicate messages, so we don’t recommend it.
On your Mac (this works with Leopard and Snow Leopard, Tiger may be slightly different):
- In Mail.app, highlight the “Sent Mail” box underneath your Gmail folder list.
- Go to the Mailbox menu, choose “Use This Mailbox For” and choose “Sent” from the submenu that appears. The mailbox should disappear from view — this is normal, and means that Mail.app is now aware of this Mailbox’s special function.
- Do the same with the “Trash” mailbox underneath your Gmail folder list, but instead choose “Trash” from the submenu.
On your iPhone, iPod touch or iPad (with v3.1.3, other versions may vary slightly):
- Start in the Settings app, choose “Mail, Contacts, Calendars” and Select your Gmail IMAP account that you created above.
- Scroll down and choose “Advanced”.
- Under “Mailbox Behaviors” you’ll see three options. Leave “Drafts Mailbox” alone and for “Sent Mailbox” and “Deleted Mailbox” choose the appropriately related mailboxes in the “On The Server” section.
While not perfect, Gmail’s spam filtering works very well. A huge benefit is that it’s all server-based, meaning your mobile devices (iPhones, iPads, etc) all get the same spam filtering, too. If all you’re using is Gmail, we highly recommend you disable all the spam filtering on your Mac and just let Gmail do its thing — it’s easy.
If you find a message in your inbox that’s spam, just move it into the “Spam” folder (you can do this from your Mac, iPod, iPhone, or iPad — it doesn’t matter where, and you only need to do it once). Moving a message into the Spam folder teaches Gmail that you believe this message to be Spam.
You should routinely go through the contents of the Spam mailbox to ensure that there are no false positives in there. If there are, simply move it out of the Spam mailbox (perhaps to the Inbox) and that will teach Gmail that this message is NOT Spam.
Important: do not delete Spam from your Mac or mobile device. Doing so will move it to the Trash folder and you risk inadvertently teaching Gmail that these messages are Spam. Instead, to remove Spam just go into your Gmail web interface, select the Spam mailbox, and click the “Delete all spam messages now” link.
That should do it but, as always, if you have any questions please post in the comments below and the community will do everything we can to help!