Nov 03

There’s a useful table located on Google’s help pages that explains the relationship between Gmail and what happens when you do certain things on a local client that is hooked in to Gmail via IMAP. One example is that when an e-mail message is “flagged” in an e-mail client (in this case Apple Mail), Gmail interprets this as “starring” the item. Similarly, a message that is “deleted” from a client inbox isn’t really deleted at all—the “inbox” label is simply removed. This may seem weird but there’s a couple ways to get syncing work a little more smoothly. This tips apply to Tiger’s Mail.app but I’d imagine there are similar settings in other mail programs such as Thunderbird and Apple’s own Mail 3.0.

One of the first things that confused me greatly was all these new labels showing up in my Gmail web interface. Not only did I have the “Sent Mail” and “Trash” sections that I always had but I had new labels that contained sent mail and messages I had deleted. What I came to realize, and what Google confirmed on their help page, was that these were messages that had been sent and/or deleted by my mail client. However, deleting them from my mail client only applied the “Deleted Messages” label—it did not, indeed, move these messages to Gmail’s actual Trash. On the help page, Google seems to imply that this behavior is somehow acceptable:

After you perform certain actions in your IMAP client for the first time, you’ll notice a few new labels when you next log in to Gmail’s web interface. For example, sending a message in your client creates a ‘Sent Messages’ label in Gmail, indicating which messages you sent through your client and not through Gmail’s web interface.

Wait, what? Why would I want to differentiate messages sent through my e-mail client and messages sent through Gmail? The point of using IMAP is that everything stays synced. Why would I want a separate label identifying what was sent at my desk as opposed to what was sent through the web? Add to this the fact that I almost never use the web interface and all my e-mail is either sent from Mail.app or my iPhone.

Fortunately, there are settings in Mail.app (and on the iPhone) that tempers this ridiculous behavior. Below is a shot of the Mail.app preferences pane for IMAP accounts. (Click to enlarge.)

Mail.app Accounts

Uploaded with Skitch!

The three settings that alleviate my pain the most deal with sent mail, trash, and junk. We’ll get to the junk later—that’s actually on a different screen. First, sent mail. I’ve already established that keeping separate client-sent e-mail and web-sent e-mail is silly. The fact is that Gmail knows when you send a message—there’s no need for your e-mail client to tell Gmail or for anything to be stored on the server. Gmail already stores every e-mail you send on its server so really all you need to do is check the [Gmail]/Sent Mail folder and everything you’ve sent using Gmail no matter where you sent it from—Mail.app, web interface, iPhone, etc.—will sync up with your client. Isn’t this the way it should be? It is that way but there’s one setting in Mail.app (and the iPhone) that makes it much easier: “Store sent messages on server.” This single checkbox is the cause of the mysterious “Sent Messages” label which Google apparently has no issue with. My issue? It’s annoying. Unchecking this box will tell Mail.app to not synchronize the messages that it sends with Gmail. Then, you can safely delete the “Sent Messages” label from Gmail and act like it never existed. The Trash experiences a similar albeit slightly more complicated problem. Since deleting a message from the inbox whether using the web interface or a client merely removes the “Inbox” label, I prefer to use this paradigm in both Gmail and Mail.app. Simply put, when I delete something from my inbox in Mail.app, I am doing so with the understanding that it is not really deleted—it just isn’t going to be in my inbox any more. The problem with Mail.app’s default settings is that it tracks these deleted messages and puts them in its own trash can of sorts. If set to “Move deleted messages to the Trash mailbox” and “Store deleted messages on the server,” you’ll end up with messages that are in the Trash in Mail.app but in the Gmail interface they will appear everywhere but the Trash: they will be in All Mail with the label “Deleted Messages.” This means absolutely nothing to me. It’s almost as if they’re half-deleted. The easiest way to get around this is to tell Mail.app to not move deleted messages to the trash. Instead, they get removed from the Inbox which is synced to Gmail’s inbox. Thus, you are essentially performing the same function in both apps—relegating a message to the “All Mail” folder only. The only caveat is remembering that “deleting” a message from Mail.app’s Inbox really isn’t deleting. To do that, just drag the message to Gmail’s trash. But really, how many messages do you delete? Typically you either want them or their spam so I find myself dragging quite infrequently.

Mail

Uploaded with Skitch!

Speaking of spam, this was a more interesting problem. There’s a Google-provided help page that suggests that Gmail’s spam protection is enough and that client-based spam filtering should be turned off or messages will be downloaded twice. I’m not sure what they mean by this as I’ve been running Mail.app’s spam protection since day one with Gmail IMAP and haven’t had an issue. The secret is tuning the “Advanced…” settings regarding where messages flagged as Junk by Mail.app go. Instead of sending Junk to Mail.app’s own Junk folder, the key is telling it to send anything flagged as junk to Gmail’s Spam folder. This in effect provides double protection: anything Gmail thinks is Spam will already be in the Spam folder and will never hit Mail.app’s inbox. If something slips through and is then flagged by Mail.app, it will be reported to Gmail as spam and removed from the Inbox. Thus, Gmail will learn and get even better at catching spam. It’s a win-win.

As I don’t write many e-mails that I save as Drafts, I haven’t tweaked these settings in Mail.app but I’m sure it would be a similar solution to the other mailboxes. Amazing, the settings in the iPhone are even more straightforward.

 

MobileMail allows you to associate the iPhone’s mailboxes directly with Gmail’s IMAP mailboxes. So, by associating Drafts with Drafts, Sent with Sent Mail, and Deleted Mailbox with Trash, you can be sure that everything you do on the iPhone is exactly mirrored on Gmail. The one caveat of this setup is that deleting a message from the iPhone’s inbox really means delete in the sense that it will actually be removed from the Inbox and sent to the Trash. To remove from the iPhone’s Inbox without deleting, simply moving the message to “All Mail” works just fine.

If I’ve missed anything in regards to Mail.app, MobileMail, and Gmail’s IMAP implementation, please leave me a comment. We can all learn from each other!

written by Ben


3 Responses to “Gmail IMAP: Tips and Tricks”

  1. 1. gari Says:

    Hello,
    I have almost 10Gb on my Google Apps account. Everything is in default folders except Backup_Inbox and Backup_Outbox, huge folders where I use to move data from time to time.

    The thing is that I would like to maintain these folders online, but i don’t want them to sync locally. Is there any setting either in gmail or in mail.app?

    many thanks in advance!
    Gari

  2. 2. Ben Says:

    Hi Gari!

    To the best of my knowledge there is no way to do this either from Gmail or from Mail.app. Perhaps there is another client that can do this – maybe Thunderbird? I haven’t used Thunderbird regularly but that’s certainly one you could try.

    Good luck!

  3. 3. mark anderson Says:

    It would be nice to see more of this.

Leave a Reply

« Back to text comment
i3Theme sponsored by Top 10 Web Hosting and Hosting in Colombia