Fixing Apple Mail – Rebuilding and Reindexing

Recently we received reports of Mail corruption. Its a corruption of a very succinct nature because on the surface Apple Mail still appears to look normal but upon inspection of the individual emails themselves, the details of the Sender is mismatched from the contents or email Subject.

Its effectively as though someone took the Sender, email contents and email Subject fields and did a crazed mix and match exercise.

How do we fix this?

In our case example, the affected email was a Gmail account which was configured as an IMAP account.

A quick check by logging into Gmail via web browser, revealed that the actual emails resident on Gmail’s server themselves were not affected – the corruption was limited to emails within Apple Mail.

The fix is a two-phased attempt. Perform the following in descending order that they are presented below.

If the earlier process solves it. Stop there. If not, proceed to carry out the following proposed solution.

#1. Rebuild Mailboxes

This process is an attempt to force Apple Mail to ‘resync’ with your email server.

According to Apple’s own support document explanation:

“When you rebuild mailboxes for IMAP or Exchange accounts, locally stored messages and attachments are discarded, and the messages and attachments are downloaded again from the mail server to your Mac. Your mailbox appears empty until the download is complete”

a. Launch Apple Mail

mail1

b. Select the affected Mailbox from the Mail sidebar

mail2

c. Click Rebuild from the drop down Mailbox menu

d. Your Mailbox will appear empty during the rebuild process until its complete

Check whether this has fixed your Mail issues. If yes, then “have a good day”, otherwise, move on to the next process below.

#2. Reindex Mailboxes

Unlike Rebuilding where users can select individual Mailboxes to be Rebuilt, Reindex affects ALL Mailboxes.

Reindexing is a last resort measure in cases of serious Mailbox corruption.

By default Apple Mail is designed to Reindex your Mailboxes if it detects a problem but sometimes, a manual Reindex is required.

a. Quit Apple Mail if its open

mail4

b. In Finder hit CMD + Shift + G to access the Finder’s Go to the folder window and copy and paste the following into the field: ~/Library/Mail/V2/MailData

c. Hit Go

mail3

 

d. Copy the following files onto your Desktop as a backup:

  • Envelope index
  • Envelope index-shm
  • Envelope index-wal

e. Delete the originals of the above mentioned index files from its ~/Library/Mail/V2/MailData

f. Launch Apple Mail – detecting the missing index files Apple Mail will prompt you to setup Mail all over again, click Continue

g. Apple Mail will begin reindexing all your emails. This process may take a substantial amount of time depending on how large your email collection is

Check if Mail issues have been fixed. If yes, then you are free to delete the copies of the index files from your Desktop.

3 Comments on "Fixing Apple Mail – Rebuilding and Reindexing"

  1. How do I delete the files, Finder doesn’t offer me ‘Cut’- I moved them to trash and and did the re-index steps and have gone back into Mail but the intial problem whereby I could only view my email content in preview and not in the email itself is still the issue. Five of my email accounts are POP and 2 are IMAP.

  2. Update: I found that instead of the V2 folder location, in MacOS Sierra, the proper location is V4. Once I looked there, I found the files that needed deleted in order to force the manual reindex.

  3. Hello. I am trying to do these steps on MacOS Sierra, but on the manual re-index steps, when I arrive at that folder location, I have no “Envelope index” files at all. Starting Apple Mail does not detect anything missing, and none get created. All I have in that folder is a file named Accounts.plist.

Comments are closed.