How to Repair Apple Mail

The situation:

  • Apple Mail is dragging, slow, and crashes. 
  • Notifications popping up to enter new password in “Internet Accounts” (Internet Accounts is located in System Preferences)
  • Preferences Error: Could not load Internet Accounts preference pane. – Mail Program crashes.
  • We use Google Apps (and Google Mail) and various other Mail accounts, which we IMAP with the Apple Mail Program

Apple Internet Accounts Password Required

Apple Preferences Error

The  solution that worked for us and made Apple Mail work smoothly again, was to reinstall all Mail Accounts fresh and after that to import all mail folders.

  • Make a backup of your computer
  • Move the V2 folder to the desktop (or any other folder). This removes all Mail Accounts and Mail Folders from Mail and when you open Mail it will be blank. the V2 folder can be found here: ~/Library/Mail/V2
  • Delete the email accounts (Gmail, exchange server etc.) using System Preferences>Internet Accounts
  • Re-start Mail.  It now re-starts as if for the first time and asks to re-input the mail accounts
  • Mail up and running again

ImportMailboxes

Part two was to re-import all mail folders. Some folders date 10-15 years back and I was afraid of loosing 15 years of email! These folders can be imported from the V2 folder that you moved to the desktop (or any other folder) with the Apple Mail import function, under the “File” tab. The folders can be found inside “Mailboxes”.

The upside of this process is, your system has a new Mail folder that has no legacy clutter slowing it down.

The Preferences Pane and Messages work again.

The Mail folder is smaller because old Mail versions had odd archives which are still in my Time Machine backup, yet not anymore in the clean Mail Application.

Importing Sub-Folders in Apple Mail

Export Apple Mailboxes

There is a downside to this: the Apple Mail import function only imports main folders, no sub-folders. The workaround would be to begin this whole process by using the “Export Mailbox…” (Tab can be found under “Mailbox”), and in the next window that opens tick on “Export all subfolders”. This works only if your Mail program was still functioning to a certain degree.

If your Mail program was not starting up anymore and you had to force quit it this cannot be done. Then there is another option to import the subfolders: OSX is hiding some files and folders and this includes the mail subfolders. The process I used was:

  • Unhide the hidden files/folders in Finder
  • Move each of the relevant files/folders (folders I plan to import) into a new folder (this I had to do so that Mail’s import function also would ‘see’ those files/folders; even though they were now unhidden, mail still would not ‘see’ them unless they got moved into a new folder)
  • Import each  of these mailboxes from this new folder

Show/Hide Hidden Files on Mac OS X

To view hidden files in the Finder, open a Terminal window and run the following commands in it, pressing Enter after each one:

Source code    
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

The first command line tells Finder to show hidden files and the second to relaunch the Finder. The Finder will show all those hidden files and folders once you’re done. They appear partially transparent to distinguish hidden files/folders from normally unhidden ones.

After you are done, you can run this commands to hide the normally hidden files/folders again:

Source code    
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Tip: Use only the first line of command and then click on Finder Icon with the Option/Alt key pressed and choose “Relaunch”

Relaunch Apple Finder

Keep Apple Mail Running Smooth with Google Mail Accounts

Login to the Goggle Webmail and in Settings set Folder Size Limits: “Limit IMAP folders to contain no more than this many messages: 1’000”. This prevents Apple Mail from constantly trying to sync all your mail.