In ~/Library/Mail, you will see various folders, like POP-user@host.domain.com, and another folder called Mailboxes, where all the rest of the mail is stored on your Mac. As you drill down into the folders, you will see that each .mbox package contains the following files:
- .index.ready -- lets Mail.app know that the content_index file is ready for searching
- .lock -- Lets Mail.app know who's got this mailbox open, so you don't have two copies of Mail both, say, trying to write to the same file (only exists when Mail is running)
- Info.plist -- Contains the preferences for this individual mailbox, things like search order, etc.
- content_index -- Is the full-text index that Mail.app uses when searching the mail
- mbox -- This is the actual mail file, with all the messages in standard unix mbox format (more on this later).
- table_of_contents -- Somewhat obviously, the table of contents. It also stores things like read, unread, etc.
I was having some weird problems with Mail hanging with 100% CPU usage, and trying to retrieve messages that I'd already deleted, so I took the shotgun approach (after backing everything up) and did the following ... *WARNING - THIS WILL DELETE FILES ON YOUR COMPUTER*. Quit Mail first, then open the Terminal, and type:
% cd ~/Library/Mail
% find . -name '.index.ready' -delete
% find . -name 'content_index' -delete
% find . -name 'table_of_contents' -delete
This series of commands went through and deleted all the indexes and table of contents from all my Mail folders. Upon launching Mail again, each time I opened up a mailbox (simply by viewing it), the status area in Mail would show me that it was re-indexing all the messages. I then went through and marked everything as read, and it's all OK now.

