Setting up IMAP in Mac Mail

After Steve’s announcement yesterday of the iPhone price drop, I finally gave in and bought the last 8Gb model the local AT&T store had in stock. After the initial sync from iTunes, the next order of business was to get Wi-Fi and Mail working.

My first attempt was to just POP into my existing Gmail account. Technically speaking, this worked fine, but it had the undesirable effect of downloading a lot of old e-mail messages that I thought were ancient history. This wouldn’t be so bad if it weren’t for the fact that the iPhone Mail application doesn’t have a way to clear out all of your deleted messages. You have to go in and delete them one-by-one. Yes, seriously.

Even if I ironed out the short-term problem of downloading already-archived Gmail messages, I was worried that this wouldn’t be a workable solution moving forward. So, after doing some research here and there I decided that what I needed was an IMAP account. I’d heard of IMAP before, obviously, but for whatever reason I’ve just never used it. Luckily, my hosting provider supports both POP and IMAP accounts, so I set up one for myself and told Gmail to start forwarding all of its incoming messages to that account. And this part worked like a charm. The same sources recommended that I get my Mac Mail client talking to this IMAP account first, before trying to get it set up on the iPhone. Fair enough — how hard could that be?

Actually adding the account in Mail went pretty smoothly. I had the names of the incoming and outgoing mail servers, as well as my user name and password. When I finished adding the account, Mail verified that it could connect to the IMAP server and that went fine. I observed that it synchronized with the IMAP server and created “Drafts”, “Sent” and “Trash” mailboxes under my standard Inbox, which at the time seemed like a reasonable thing to do. I could even see that the messages that Gmail had forwarded to the IMAP account were there in my Inbox now.

The problem that I started running into was that when I tried to compose a new e-mail message in Mail, and save a draft of it, Mail would pop up a dialog box with a cryptic error message: “The message could not be saved”. No indication why it couldn’t be saved, or what I could do to correct that problem. I also discovered soon after that I couldn’t send e-mail messages. When I tried to send messages, I didn’t even get an error dialog; the messages just disappeared into the ether.

So I started doing some more research online, and quickly discovered that I wasn’t the first person to run into this problem. The general consensus was that Mail’s support for IMAP is a little flaky, but several people offered their solutions and workarounds. One of the necessary steps is to tell Mail that the IMAP path prefix is “INBOX”; the other necessary step is to set up a mapping between the remote “Drafts”, “Sent” and “Trash” folders to the same folders in Mail.

The part that I got wrong was the order of these two steps, and to make a long story short, it apparently matters. If you define the IMAP path prefix first, it doesn’t seem to work properly. In my case, the “Drafts” folder would just disappear altogether with no way to get back to it. So wait to do that after you’ve set up the mappings. It took me most of the day to get this working, but it does seem to be OK now.

Posted September 6th, 2007 in Apple.

One comment:

  1. Evan:

    And I would be one of those poor bastard who told you that Mail.app was “flakey” about IMAP. ;-) Even now, the way that it handles my junk mail is a little… shall we say odd?