Mail.app and GMail • Gated Logic • nevali.net

It’s a widely-believed fact that Mail.app is a very pretty e-mail client, but isn’t necessarily the most “technically able”. That’s a nice way of saying it’s the MUA equivalent of being Miss Cupertino.

When Google rolled out support for IMAP, users the world over rejoiced—until Mail.app users actually tried it. The biggest problem Mail.app has is that it has no ability to unsubscribe from non-shared folders (unlike, say, every other IMAP client in existence), and so Mail.app will go away and index and the contents of [Google Mail]/All Mail, which contains a copy of every message in your GMail account, excluding those in your Trash or Spam mailboxes. If your account is anything like mine, you currently have a quota of about 6GB, and are probably using nowhere near that—but you’re quite possibly using an amount that’s close enough† so as to cause Mail.app some serious consternation.

There is a solution, however. It’s not ideal. The ideal solution would be for Apple to fix Mail.app. This solution works on the basis that you use Mail.app (and possibly other desktop clients) as your primary means of accessing your e-mail, and fall back to the web interface on the odd occasion. If you want to use the web interface on a regular basis, you may find this solution is unworkable. Having said that, you will (as you’ll see below) still need to use the web interface anyway for one specific purpose.

Attempt this at your own risk. This is about as experimental and hot off the presses as it could be. There are probably very very good reasons why you shouldn’t do this, and I will discover them the hard way—I just haven’t go that far yet.

  1. Create a label in GMail called “Mail”.
  2. Create a new filter in GMail. Set it to match all messages which don’t include some random string. Bash the keyboard (gently)—it’s probably the best way to get a string of random characters that are highly unlikely to appear in any of your messages. GMail doesn’t seem to offer a way to say “apply this filter to everything”, but that’s not hugely surprising.
  3. Instruct GMail to apply the filter to your existing messages. Your “Mail” label will be your Inbox, as far as Mail.app (and other clients) are concerned. The messages will still show up in GMail’s Inbox when you use the web interface, because you’re not actually moving the message, just applying a filter.
  4. In Mail.app, and any other clients you use, set the “IMAP Path Prefix” (wording may vary) to “Mail” and save changes.
  5. Let your client do its thing; Mail.app may well take a while over this. Once it’s done, you’ll discover that nothing seems to have changed except that you don’t seem to have any folders any more.
  6. In Mail.app, create folders for “Sent”, “Drafts”, “Junk” and “Trash”. This is the big snag to all of this: you lose integration with GMail’s own Sent/Drafts/Junk/Trash system (it’s smart enough to treat those folders specially when you use the ones under [Google Mail]. Essentially what you’re doing here is letting your mail clients deal with all of that stuff instead of GMail.
  7. In GMail, rename any existing labels so that they’re prefixed with Mail/. For example, Mail/Apple Mail To Do.
  8. You may find it helpful to restart Mail.app to force it to re-read all of its folders.
  9. For each of Sent, Drafts, Junk and Trash, select the mailbox and choose Mailbox > Use This Mailbox For > and pick the appropriate option.

Okay, reasons why this may well fail miserably:

  1. You have no access to GMail’s spam folder. This means you need to log into GMail to deal with false positives, and also means that marking something as spam in Mail.app won’t notify GMail that it really is spam, and vice versa. In other words, you cease training GMail’s spam filter the moment you do this.
  2. Deleting messages is… dubious. Messages don’t (in my limited testing) seem to actually get deleted, they just have the Mail label removed (they don’t seem to have the Mail/Trash label added either, oddly). I may be doing something foolish here, though.
  3. I’m not 100% sure on what happens when you delete messages. Now that I’m not forcing everything into the Mail label, I’ve a feeling things may Just Work, but I’ve not tested extensively.

The bottom line is: this doesn’t work very well, really, but if you have a GMail account which you use for archival rather than day-to-day purposes, and have more messages in All Mail than Mail.app will comfortably deal with, you may find it helpful. Otherwise, wait for one of Apple or Google to figure out a sanctioned way to do this.


† It doesn’t actually seem to be the size of the messages that causes a problem, but the sheer number of them. If All Mail contains about 20,000 messages, everything falls apart on Mail.app’s end.