Setting up Apple Mail to Rock and Roll with Gmail

Tutorial for getting Mac Mail to play nice with Gmail.

Goals

  1. To get the Delete button to move messages to the Trash
  2. To use the Archive button

Note: As of this writing I’m using Mac OS X 10.7.3 Lion with Mail version 5.2. Also, this article assumes you already have setup your Gmail account in Mail, and that you are using IMAP.

Deleting Messages

If you set up Apple Mail using Google’s Recommended Gmail IMAP client settings, deleted messages will not show up in the Trash mailbox–they show up in the All Mail folder. Here’s why:

In Gmail, when you receive a new email, this email actually has two labels: “All Mail” and “Inbox.” Deleting a message from the Apple Mail inbox removes the “Inbox” label. So when you delete messages, it removes the message from your inbox, but doesn’t permanently delete the message. The messages still exist in “All Mail.”

Note: Gmail uses “labels” instead of “folders.” Folders in Mail are your labels in Gmail.

Deleting a message from a folder removes that label from the message, but it still remains in All Mail.

See: How do actions sync in IMAP?

My Improved Settings

I prefer to hit the delete button and have the message go to the Trash. If there’s a message I want to save, I move it to the proper folder (technically a “label”) or Archive it.

Step 1: Configure Apple Mail preferences

You need to setup Apple Mail a little bit differently than the recommended settings. Open Mail Preferences, make sure the Accounts tab is selected, select your email account from the list (if you have more than one), and select the “Mailbox Behaviors” tab.

Check the options to “Move deleted messages to the Trash mailbox” and “Store deleted messages on the server.” Set “Permanently erase deleted messages when” to “Never.”

Next, go to the Advanced tab and set [Gmail] as the IMAP Path Prefix:

Make sure to save your changes when you close the preferences window. If you have a lot of messages, this may take a few minutes to sync. Just for precaution, restart Mail to make sure everything is in sync.

Setting the IMAP path prefix to “[Gmail]” gets rid of the ugly [Gmail] in the mailbox pane, although you may notice your custom labels are missing. Don’t worry—they haven’t been deleted. Mail just doesn’t know where to find them yet.

Step 2. Assign mailbox functions

You should assign the correct mailbox function for Drafts, Sent Mail, and Trash. Starting with Drafts, click on the Drafts folder/label under your email account name—then go to the Mailbox menu and select “Use this Mailbox for” and select Drafts. Then do the same for Sent Mail and Trash, carefully selecting the corresponding function.

Step 3: Set the [Gmail]/ prefix on custom labels

After everything is synced in Mail, go to your browser and login to Gmail.

Go to Settings, then click on the Labels tab.

If you have created any custom labels, you will need to add “[Gmail]/” to the name of each label to get it to show up in Apple Mail. From now on when you create a new label in Gmail, remember to add the [Gmail]/ prefix so they show up in Apple Mail.

Step 4: Designate which labels show in IMAP

While you’re in the Labels tab, uncheck the “Show in IMAP” box for All Mail because you don’t want that showing up in Apple Mail anymore. This is important to ensure the delete button sends messages to the Trash in Mail.app.

The “Show in IMAP” box will determine which labels appear in Apple Mail. Feel free to uncheck the “Show in IMAP” box for any other labels while you’re at it. Changes are saved automatically.

Step 5: Forwarding and POP/IMAP

Next go to the Forwarding and POP/IMAP tab. IMAP should be enabled and check the following settings:

When I mark a message in IMAP as deleted:
Auto-Expunge off – Wait for the client to update the server

When a message is marked as deleted and expunged from the last visible IMAP folder:
Move the message to the Trash

The key here is “last visible IMAP folder.” Now that you’ve hidden the All Mail label in IMAP, there should only be one “visible” copy of your message, so when you delete the message in Mail, it will now move the message to the Trash.

Make sure to save changes.

Step 6: Restart Apple Mail

Restart Mail to make sure it is in sync with Gmail.

Step 7: Test it out

Now when you delete a message from your Apple Mail inbox, it should show up in the Trash. The action should also be mimicked in Gmail.

Note: Messages that are in the Trash will be automatically deleted permanently after 30 days. You can empty the Trash manually in Gmail if you wish.

To create a new label in Mail, simply use the Mailbox > New Mailbox feature and type the in name.

ARCHIVING MESSAGES

Step 1: Add the Archive button to Apple Mail

Right-click on the toolbar in Apple Mail and choose “Customize Toolbar…” Find the Archive button and drag it to the toolbar.

Step 2: Find a message that you wish to archive and click the Archive button.

Apple Mail will create a label called “Archive” under your Gmail account and move the message there.

But…

There is a discrepancy between how Apple Mail and Gmail handle archiving. In Gmail, as you know, there is a label called “All Mail.” This is where the archived messages are stored. When you receive a new email, this email will have two labels: ‘All Mail’ and ‘Inbox’. When you archive a message in Gmail, you are actually removing the label ‘Inbox’.

As you may have noticed, when you archive a message in Apple Mail, it gives it the label ‘Archive.’ I think this is perfect, because if it sent the message to ‘All Mail’ it would not be viewable in Apple Mail since we have hidden that label. You would have to go into Gmail to search for it or view it.

 

So, in conclusion, I’m now happily using my Gmail accounts in Mail.