How to make Gmail IMAP play nice with Apple Mail.app

I know. This should be a no-brainer. However, I didn’t use Mail.app with Gmail for a long time because Mail.app created strange labels in my Gmail Web interface and, most deal breakingly, refused to delete my messages but instead kicked them into a new label or back into the Archive label (depending on the option I checked in the Accounts –> Mailbox Behaviors –> Trash section). This meant that I had deleted messages scattered all over Gmail and a bunch of weird labels that I didn’t want. (Please, no comments on “why would you delete anything from Gmail, with those gazillion gigs of storage?”…I really don’t want stored copies of notifications that my credit card bill is available! I can stagger on without it!)

Invariably someone is wondering, “WTF is IMAP?” There is a complete technical explanation about POP and IMAP here. Basically, you’ve got your Web mail, which is what you see when you get your mail through your Web browser; your POP mail, which downloads a copy of your mail from the server to your local computer (through Eudora, Thunderbird, Mail.app, or another mail client; the fate of the original e-mail is to remain undisturbed on the server or to be deleted); or your IMAP mail, which syncs your e-mail between the server and your local computer. Why care? Because if you, like me, have various labels or folders with which you organize your mail, it’s a pain in the ya-ha to keep them spic and span on your local computer and then just have a messy inbox in your Web mail. I want it the same no matter how I approach my e-mail, and Google is nice enough to provide free IMAP. IMAP is not for folks who don’t have always-on Internet connections. No connection = no mail.

Now I will make another brief digression because undoubtedly readers will wonder why I would not want to solely use Gmail’s fabulous minimalistic Web interface. It’s OK. It’s way better than Yahoo! Mail. I use it without flinching too much if it’s convenient. Still, I like Mail.app because there are no ads, because it’s easy to include photos, and because I like the data handlers. I use Mail Act-On to assign keystrokes that deal with my mail more intuitively than Gmail’s. I additionally like the integration with Apple’s Address Book and the fact that custom pics for people show up in their e-mails (hey! eye candy is A-OK!). I can also now report that dotmac does effectively sync all the settings and accounts for Mail.app. Cool.

So. If this all sounds good, head over to Gmail and read their instructions for setting up IMAP with Apple Mail, except when you select Gmail in the accounts pane and then go to Mailbox Behaviors –> Trash, tick both options (“Move Deleted Messages to the Trash Mailbox” and “Store Deleted Messages on Server”). This is important as it directly counters Google’s directions. Finally, close out of the preferences, saving everything, and head up to the MAILBOXES section in the top left of your Mail.app window. Click the arrow next to “Sent” and then when it expands click once on “Gmail.” Head way up to your menubar and click Mailbox –> Use This Mailbox For –> Sent. Do the same thing for “Trash” (only pick Trash instead of Sent, obviously). You can use this same sequence to use your Gmail Spam folder for Apple.app junk if you have selected “Move it to the Junk Mailbox” in the Junk Mail preference pane.

Voila! You do not have sent and deleted mail all over the place: only in the “Sent Mail” and “Trash” labels in Gmail. Good times for everyone.

18 Comments »

  1. shrop said

    I setup Apple Mail with Gmail the exact same way. The trick about assigning sent, junk, draft, etc mailboxes to the proper gmail folders really makes Apple Mail with gmail more usable.

    Thanks!
    Shrop

  2. roz said

    but you still get that extra folder on the side for starred and all mail which I hate. anyway to kill those?

  3. notratched said

    Not that I know of; I can use the “Get account info” dialog to get to a subscription list, but I can’t get Mail.app to populate it. Perhaps it’s because these are “labels” instead of folders…dunno. Anyone?

  4. I would love to have a button in my Mail.app that allows Archiving like the Archive button in the web interface. Does anyone know Apple Script, because I think it might be necessary to use Apple Script for that and adding a button that triggers that!

  5. notratched said

    I don’t know nothin bout no buttons (I’m a keyboard-only girl), but Mail Act-On (http://www.indev.ca/MailActOnAndLeopard.html) lets you assign keyboard shortcuts. I have ctrl-A archive my mail to the All Mail label, just like pressing Y does in the Gmail Web interface.

  6. Tahnks for posting

  7. Danny said

    Wow – thanks for the tip and taking the time to write it!! I didn’t even stop to think there may be a built in way to map the folders manually. You saved me a lot of frustration!

  8. Brian said

    I am wanting to switch to IMAP but I don’t see how it is possible in Mail 3.0. Do I have to delete my accounts and set up new ones? If so will I lose everything I have in my accounts now?

  9. notratched said

    Can you update Mail.app to 3.4? I think the IMAP implementation in 3.0 was really bad. If you delete your POP account to switch it to IMAP, you’ll lose all the messages unless you’ve left them on the server (in which case they’ll all download when you set up the IMAP account, but they’ll all be in one giant folder). You can export the e-mails with a variety of tools before you hose the account and then reimport them if you want.

  10. ez said

    Nice post, exactly what I was looking for!

  11. J L said

    Great tips — wish I had learned about the “Use This Mailbox For…” feature earlier. It took some wrangling with filters on the GMail web interface to set things straight and eliminate the old “Sent Messages” / “Deleted Messages”, etc. labels.

    However, there’s still a problem. Mail will now properly delete messages to the Trash and purge them as scheduled, but when you *move* a message by dragging it to another account, the old message won’t be deleted. It will still show up in All Mail.

    So you’ll still have to periodically search your All Mail for orphaned messages that have no label, and decide whether to delete them or not.

    Thought I’d point this out as it might be a security issue for some, and a storage / mailbox complexity issue for others.

  12. Seb said

    nice tips.
    I agree with the previous poster though, JL. The only way to get rid of email for good (to the gmail trash) is to drag the files in there. After all, it’s not much of a hassle.
    another tool that might become handy, if like me, you do not want to have duplicate emails, is the new lab feature of google: advanced IMAP controls. These will allow you to choose what folder shows (or does not) in your IMAP client. Very useful.
    one suggestion: you can actually use the draft folder of gmail as your mail.app draft folder. just follow the same step as for the sent email / trash folders.
    All drafts will be saved online – and you will not have too many folders showing up on the right side of mail.app.
    One question:
    My “sent” folder, only displays the emails I just sent after setting up mail.app and imap.
    it will not show all the items available under Gmail/Sent mail.
    not a big deal for me, but I was wondering whether there was an option for that :-)

  13. jp said

    roz,

    If you go to the account settings and click advanced under your gmail account you’ll notice a text box that says ‘IMAP Path Prefix’ next to it. If you set the prefix to [GMail] it will hide all the extra folders/labels that (I think) you are referring to. The only problem with this for me is you can’t see extra folders/labels you setup via the webmail interface. I stumbled across this blog just now looking for information about that problem exactly. I don’t use the all mail folder very much. I have folders setup for saving mail I care about saving. I’m not that big a fan of the All Mail folder at all.

  14. jp said

    Follow up to my last comment, the prefix is case sensitive which is why I couldn’t see me labels. I had two prefixes, [GMail] and [Gmail]. It appears that [Gmail] is what the web interface uses when you create custom labels. Check this link out for more information:

    http://www.macosxhints.com/article.php?story=2008041016554622

  15. [...] ich mich gestern durch das halbe Internet gelesen habe, bin ich einer Lösung zu meinem Problem nicht einen Schritt näher [...]

  16. Azurite said

    Hi,
    Thank you so much for this! I was going crazy finding all these orphaned messages not in their right places. I’m still trying to figure out if there’s a way for me to hit “Delete” and have my messages move to the trash instead of having the label removed and the message moved to All Mail; can the Mail Act-On do that? Even though dragging and dropping is supposed to be easy, I find that hitting a button is even easier and I wish that “Delete” meant DELETE, not something else bizarre that Google concocted.

  17. Henk said

    with IMAP advanced feature of Gmail labs you can get rid of All Mail.

  18. Ed said

    I think that I have the settings configured as you have stated, but when I highlight my gmail sent folder under mailboxes, I go to “use this mailbox for” and all the choices are grayed out. Also I ticked the 2 options for my gmail account in apple mail preferences, but under mailboxes, there is not a trash mailbox for gmail.

RSS feed for comments on this post · TrackBack URI

Leave a Comment