There are many applications that are used enterprise-wide for a number of different industries. But few are as mission-critical and ubiquitous as email. The instant gratification of exchanging information in such an effortless way is taken for granted until something goes wrong. One never truly feels the sting of helplessness in such a way as when email access is lost, or more specifically, access to saved email messages is not immediately available due to loss or corruption. There may even be legal ramifications depending on the laws that govern your particular employer or industry, or those enforced by state or country.

Before I continue, I’d like to point out that try as I might, I couldn’t find any concrete documentation regarding the limitations of Apple Mail with respect to maximum number of messages, folder sizes, etc. With that said, Mail should be just as responsive with 10GBs of data as it would be with 10MBs – until the day it’s not! That’s just how quickly problems like this can creep up, so if you notice Mail slow to load, crashing frequently, or even spiraling the color wheel to no end, it may be time to take counter-measures.

The solutions outlined below range from entry-level to extreme-case scenarios. The amount of time and storage space needed to recover from data loss or corruption will depend solely on the number of email messages stored within the folders.

DEFCON V: Rebuild

  • Open Apple Mail.
  • Select the folder(s) you wish to include in the rebuild process.
  • Click on Mailbox | Rebuild.

Figure A

Simple as that! This offers a simple way to rebuild the various mail folders, removing any stray files cluttering up the mailbox folders.

DEFCON IV: Restoring preferences

  1. Quit Apple Mail.
  2. Navigate to the following directory: ~/Library/Containers/ (OS X 10.7+)* and drag the following file to the Desktop: (Figure B)
  3. Open Apple Mail to allow the application to recreate a new preferences file.

Figure B

Restoring preferences is not always a sure-fire solution (and can sometimes cause more trouble than it solves, if the wrong files are removed). But it’s almost always worth a try since sometimes the only solution is OS X recreating the .plist file to get things humming along and have all email messages showing up again.

*Note: For OS X (10.4-10.6), the proper directory is ~/Library/Preferences.

DEFCON III: Archiving (Exporting Mailboxes)

  1. Open Apple Mail.
  2. Select a folder to create an archive from. If selecting a root folder, all nested directories will also be archived automatically as well. *
  3. Right-click (or control+click) and select Export Mailbox from the context menu. (Figure C)
  4. Select the destination for the exported mailbox folder(s) and select Choose. (Figure D)
  5. Optionally, double-check the newly created .MBOX file(s) to verify the entire file structure selected within Mail was properly exported. Each folder selected in will be represented by its own .mbox file in the hierarchy. (Figure E)

Archiving offers a way of exporting data from Mail to an alternate location, in the hopes of removing it entirely from to free up space or just perform some cleaning up. This method allows one to keep the emails for future perusal without it impacting negatively on Mail’s daily usage.

*Note: While it is possible to select multiple folders to export, bear in mind that when working with large amounts of data or many folders or folders nested within folders, keeping track of which .mbox files contain specific messages can become dizzying. Instead, focus on keeping folders to be exported grouped together, similar to the Apple Mail structure for the sake of simplicity. This way, if it’s necessary to revisit these files later to recover a missing message, it won’t be so complicated to find, plus, I find it minimizes the possibility of merging corrupt data with non-corrupt sets.

DEFCON II: Recovery (Import Mailbox [.mbox] Folder)

  1. Quit Apple Mail.
  2. Identify the location of the mailbox folders to be imported (either locally or from external backup/Time Machine). If local, the directory is: ~/Library/Mail/V2
  3. Located within the folder structure will be a root folder for each email account that has been added to Apple Mail. By navigating down one level, you will find the root mailbox folder for the directory hierarchy. Double-clicking the .mbox file will allow you to drill-down to locate the mailbox folder you wish to restore.
  4. After the .mbox file to be restored has been identified, open Apple Mail and click on File | Import Mailboxes (Figure F)
  5. A wizard will open to guide you through the process. Select Apple Mail instead of Files in mbox format for the best chance at compatibility importing your files and select continue. (Figure G)
  6. You’ll be prompted to locate the mbox file (or root folder containing mbox files, if there are multiple files you wish to import). Navigate to the location identified in step #3 and select choose. (Figure H)
  7. Once the process has completed successfully, you’ll see a confirmation screen informing you that the imported files can be found in the Import folder under On My Mac. (Figure I)
  8. A successful mailbox folder import will be an exact duplicate of the files/folders from the locally stored mbox folder or external backup mbox file. (Figure J)

This process can be one of the most nerve wracking when it comes to dealing with importing mailbox folders or worse — the last stand between restoring an end-user’s months, years or even decades worth of emails and complete loss of email.*

*Note: While most organizations still rely on the venerable POP3 protocol to retrieve email, it must really be noted that the IMAP protocol eliminates a lot of this from occurring at the desktop-level with its built-in synchronization features. Going somewhat off-topic, this is a good time to reiterate the importance of timely backups for all of ones important data. However, in the event that backups of email messages are not possible or expressly prohibited, an IMAP-enabled account could simply be removed from and recreated, thus triggering the sync upon establishing a connection with the email server.

DEFCON I: Third-party email management application

This is a worst-case scenario for recovering from severe email corruption, brought on by any combination of the previous levels above, combined with the sheer volume of messages contained in Apple Mail. We’re not talking 10-20GBs here, but more like 80GBs+ of emails and attachments. If the size of the mailbox was not difficult enough to manage on its own, when you sprinkle in file corruption, missing data, and an application that is literally paralyzed for 20-30 minutes before opening the main window, you have a recipe for disaster!

By the time Apple Mail gets to this level, some if not all, of those symptoms would have set in, making resolving the matter something else entirely. How do you battle this beast and live to tell the tale? With careful planning, exercising caution, and a little help from a third-party Email Management application.

I researched several applications that would serve well to help get’s mailbox folders to manageable levels. Here are a few that stood out:

  • EagleFiler from C-Command Software, which is billed as a way to “organize, search, and archive your e-mail, Web pages, files, and miscellaneous scraps of information” by the developers. Its general purpose is to archive your data – all of it in one easy-to-use app with many hooks to popular add-on applications.
  • DEVONthink Pro Office from DEVONtechnologies is next on the list. This application is full-featured for all manner of office related duties and it’s gorgeous in its execution. However, based on personal testimonies, ease of use, and integration, I’ve personally implemented…
  • MailSteward from MailSteward does one thing only and it does it well — archive email! Either manually and/or based on an automated schedule, it creates a database and proceeds to copy (not move) your email from Apple Mail onto the database, complete with attachments and all! Once it’s completed, the newly archived emails are safe to delete from thereby eliminating the huge processing load brought on by the GBs of messages stored. Since MailSteward works from a local database, information is indexed and fully searchable making finding messages by a number of search queries effortless. Also, attachments are included alongside the original messages as well for ease of use.

Just to be clear, I’m not advocating a specific app over the others. The bottom line remains that each scenario will be a unique issue all unto itself due to the sensitive nuances of the user’s email and what resources are available to you. While similarities exist and many of the troubleshooting tips above will work, you’ll find that they won’t all be a right fit to resolve the problem. Ultimately, at this level, the program that works best is the one that fills a specific need most completely. Most offer a free trial to test out which will allow for the best chance of recovery.

However, the best tools in overcoming email corruption (or preventing a catastrophic loss) are a good, recent backup of the data, caution, and lots of patience. Once data is backed up and in a recoverable state, safety measures can be implemented to minimize the possibility of a repeat failure. A secondary backup archiving solution, while completely optional, never hurt anyone either.