Friday, June 12, 2009

Configuring Apple/Mac Mail to work seamlessly with GMail

Are you a Gmail user and like the features of the Mail application on Apple’s Mac OS? There are a few tweaks that will allow you to seamlessly integrate the two that I have not found documented anywhere. The major steps are:
  1. Enable access to Gmail from other e-mail applications.
  2. Configure Apple Mail to access yor Gmail account.
  3. Tweak the Mail settings to sync seamlessly with Gmail.
These steps will allow you to leverage the advantages of Mail in reading and composing e-mail for your Gmail account.

Gmail, Tagging, and Folders

First, a little background about how Gmail works; if you know all this, you can skip ahead to the next section.

I’m a big fan of Gmail. I’ve tailored Gmail and my e-mail readers to work together so that I can continue to use my own domain’s e-mail address—to the rest of the world, my e-mail address has not changed. At the same time, I can use any web browser to access my mail on any machine, I get Gmail’s spam and phishing handling, and when I use other mail applications, the organization of the mail is consistent (notably the “Sent Mail” folder).

Gmail has a different approach to e-mail. Instead of organizing mail into folders, it allows you to “tag” each item with any number of tags. This is a great idea... many times a mail item does not fall neatly into a single “folder”; by adding multiple tags to an item, you can effectively put the same item into several folders.

Since other mail applications only have the concept of folders you’ll have to use the web page to manage these tags. Keep in mind when using an e-mail app,

  1. Moving items from one “folder” to another, that Gmail is actually adjusting tag, and
  2. An e-mail item may appear to be in more than one folder when, in fact, it is the same e-mail item with multiple tags.
The tweaks, in the last section of this article, help to coordinate the handling the actual Gmail folders with the Apple Mail application’s folders.

1. Enabling Access to Gmail

Gmail allows access to its mail from other e-mail applications through standards, POP3 and IMAP4. Forget about POP3 unless your e-mail application doesn’t support IMAP (POP3 only allows programs to copy e-mail from the server, IMAP allows the e-mail program to organize mail in sync with the server). To allow other e-mail applications to access Gmail, you need to enable this in the Gmail settings, on its web page.
  1. After logging into your Gmail account, click on the “Settings” link, in the upper right of the web page and select the “Forwarding and POP/IMAP” tab.
  2. In the “IMAP Access section, set the Status to “Enable IMAP.”
  3. If there is an Auto-Expunge setting, set it to “Immediately expunge messages when I mark them deleted in IMAP.”
  4. Save the changes with the “Save Changes” button.
You Gmail account is now ready allow other e-mail applications to access mail.

2. Configuring Apple Mail

If you’re already using Mail, then you’ve probably already configured it to access one of your e-mail accounts.
  1. Open Mail preferences (Mail --> Preferences...) and select the “Accounts” tab.
  2. Add a new account by clicking the “+” at the bottom of the “Accounts” list, on the bottom-left, to start the wizard.
    1. Enter Mail account identifying and login information—the name that appears with your e-mail address, your e-mail address; (click “Continue”)
    2. In the “Incoming Mail Server” step:
      1. Select IMAP in the list,
      2. Set the description to an account name for the account,
      3. Set the “Incoming mail server” to “imap.gmail.com”, and the Gmail ID (i.e., Gmail e-mail address) and password. If you are unable to continue from this wizard page, make sure that your Gmail account is set up to support IMAP access (see above).
    3. In “Outgoing Mail server:”
      1. Enter a description that identifies this outgoing mail server so it be used by another account,
      2. Enter “smtp.gmail.com” for “Outgoing Mail Server,”
      3. Enable “Use only this server” by checking its checkbox (any mail sent through this server will automatically show up in the “Sent Mail” folder of the Gmail account),
      4. Enable “Use Authentication” and enter your Gmail ID and password, once again.
    4. On “Outgoing Mail Security,” check the “Use Secure Socket Layer (SSL)” and select “Authentication” as “Password.”
    5. After creating this account, select the “Advanced” sub-tab on the Account preferences for this new account. Here, you can set the “Keep copies of messages for offline viewing” as appropriate to match the balance of how much of the online mail you want to download.

3. Tweaking Mail

Now that you have the basic IMAP mail configured for Gmail and Apple Mail, we need to set Apple Mail to sync with the “Trash,” “Drafts,” and “Sent Mail” folders. Without the following changes, the trash, drafts, and sent mail on the Mac will not match that of Gmail. There is no user interface in Mail to do this, so this where we need to perform a little magic.
  1. Very importantly, make sure Mail is closed and not running.
  2. Open a Finder window to your home folder and navigate to Library then Preferences.
  3. Open “com.apple.mail.plist”.
  4. Expand the “MailAccounts” key and you will see several sequential entries “Item 1,” “Item 2,” etc.
  5. Look for the Gmail account by expanding each item, looking at each item’s “AccountName” key with its value matching the account name given to the account, above.
  6. Change the folders that Mail knows with the folders on the Gmail server, in order to keep those folders in sync. Double-click on the value fields of the following keys:
    1. Change the “DraftsMailboxName” value from “Drafts (account name)” to “[Gmail]/Drafts”.
    2. Change the “SentMessagesMailboxName” value from “Sent Messages (account name)” to “[Gmail]/Sent Mail”.
    3. Change the “TrashMailboxName” value from “Deleted Messages (account name)” to “[Gmail]/Trash”.
  7. Save and close “com.apple.com.plist” preference file.
Restart Mail at your leisure and mail away!

[Direct link to this post]