Jan 19 2006
Fixing Mail when it crashes during launch
I had a situation tonight where Mail was crashing on my Power Mac when I tried to launch it and check my mail. I have several email accounts setup and I could see that it was coming up and trying to show the last message that I was viewing in my Gmail account before I closed it previously. Just afterwards, it would crash.
After several times of trying to launch Mail and clicking on a different mailbox to no avail, I started poking around in my ~/Library to see if I could find anything. I came across ~/Library/Preferences/com.apple.mail.plist.
At the top of the preferences file is a string named AccountInfoLastSelectedAccountId. I soon discovered that the mailbox ID that this was pointing to matched the uniqueid for my Gmail account under MailAccounts. So, I copied the uniqueid string from my primary mailbox to the AccountInfoLastSelectedAccountId field. I saved the preferences file and relaunched Mail.
Unfortunately, my happiness turned to disappointment not too long afterward, because it died again just as it had been doing. So, I went back to the pref file for Mail and poked around some more. This time, I came across an array field named SelectedMailboxes which is in the first dictionary under the ActiveViewers array field.
I noticed that the string value for the first selected mailbox pointed to my Gmail account. This time, I copied the mailbox account string for my primary mailbox and replaced this string in the SelectedMailboxes section.
I saved the preferences file, relaunched Mail, and to my joy, it is working without crashing again.
Just a note, please make a backup of a .plist file before editing it. This way, if you make a mistake, you will have the original copy to revert back to.
Hopefully this tip will help someone in the future who might have this same problem.