Headshot-color me@jbrains.ca Find out where I'm appearing

Fixing Mail.app as it pertains to IMAP and gmail

I am in the process of making gmail my One and Only Mail Database. My first tentative steps showed that gmail filters duplicate emails, which is great, because I have multiple copies of several hundred emails, thanks to POP. Naively, I just started dragging emails from my other Inboxes to my gmail/IMAP/personal mail Inbox and letting the messages synchronize on the gmail server. My goal was to make my other Mail.app accounts empty so I could disable them. This worked well for a while, but for most of today, Mail.app has been telling me this:

Mail has undone actions on some messages
so that you can redo the actions while online.
Mail has saved other messages in mailbox “INBOX”
in “On My Mac” so that you can complete the 
actions while online.  

Additional information: The attempt to read data 
from the server “imap.gmail.com” failed.

I read an article or two and figured I’d overburdened my gmail server and it was scolding me by limiting my access for a while. When about eight hours passed without any change, I knew I had a problem, and that problem was the same email over and over again. Something about embroidery of all things. Each time the message popped up in my “On my Mac” INBOX, I moved it to Trash, then erased deleted messages… nothing worked. Finally, out of desperation, I simply pasted the entire message—you can see it’s quite long—into Google.

Seek and ye shall find.

The advice there, however, didn’t impress me. I might not be a Mail.app developer, but I imagine that if I delete my entire offline cache, I’ll lose all the emails I moved into my gmail/IMAP/personal mail inbox. That would be bad, considering it’s about 10000 messages, many of which matter to me. I thought I should investigate, and fortunately, it wasn’t too hard to figure out what to do.

I went to ~/Library/Mail/IMAP-[myemailaddress]/.OfflineCache and saw about 10000 numbered files. I looked at one of them and saw an email. I figured I could grep to find the offending email, delete it, restart Mail.app, then all would be well. So I did, and so far it is.

To be clear, here is what I did:

$ cd ~/Library/Mail/IMAP-****/.OfflineCache
$ ls
1000		1001		1002		1003		1004		1005		1006		1007		1008		1009
1010		1011		1012		1013		1014		1015		1016		1017		1018		1019
1020		1021		1022		1023		1024		1025		1026		1027		1028		1029
....
$ grep -i embroidery *
[...Matched email 854....]
$ rm 854

That worked great. I hope it helps you, too.

June 11, 2008 03:00 mac, just to be clear
blog comments powered by Disqus