10 Replies Latest reply: Jun 17, 2008 3:25 AM by Gabriel Radic
Guychi Level 1 Level 1 (0 points)
I noticed in the last few days that searching for email messages, either from within Mail.app or directly from spotlight, fails to find emails that I recently received and haven't deleted. (At the very least they should have shown up in the trash mailbox).

After trying to delete the Envelope* files and rebuilding the mailboxes, it started crashing completely.

I then restored both the entire ~/Library/Mail folder as well as the ~/Library/Preferences/com.apple.mail.plist file from my 1 day old Time Machine backup.
Launching Mail after this restore brings up the "Welcome to Mail" window, as if upgrading from Tiger and it then starts importing mailboxes.

After a few hundred (out of ~30,000) messages Mail.app just crashes, and trying to launch it again repeats the precise same thing again and again.

I've also tried launching it after having uninstalled all bundles by the way, and the crashes are pretty much the same.

I did note, however, that the Envelope files that are normally in the ~/Library/Mail folder, are non-existant in any of the Time Machine restore points - this seems like the reason Mail.app absolutely must start by importing the mailboxes, to create an Envelope Index etc.

Any advice for solutions/workarounds etc. would be most appreciated - I'm currently Mail-less!

Thanks!
Thanks.

MacBook, Mac OS X (10.5.2)
  • 1. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    daveblair Level 1 Level 1 (5 points)
    I'm having a similar problem after using Time Machine to transfer my entire system from one MacBook Pro to another. When I launch mail, it welcomes me and tries to import, gets to 523 messages out of 44,000 and the time starts climbing at the bottom of the screen. When it reaches a time remaining of about 6 hours it crashes, leaving no account set up and no mail imported. I've tried this several times and even migrated an additional copy of my Mail folder from the time machine drive, with exactly the same result.

    I'm going to try repairing permissions, then try a firewire connection to my old MacBook Pro and try to import from the mail folder on the original drive.

    Other ideas welcome.

    Dave
  • 2. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    daveblair Level 1 Level 1 (5 points)
    I made a copy of the mail folder to the root level of the hard drive, leaving the original in place in Users:Library:Mail. Always like to have a backup, however there is still one on the time machine drive and on my old hard drive if this isn't successful.

    I then went to Disk Utility and ran Repair Permissions on the boot drive.

    I then re-launched Mail. At this point it did come up with the correct user accounts showing, however all mailboxes were empty, and only new mail started rolling in. All my mailboxes were in place, however. I then went under File to Import and reimported all my mail again in the standard way. I am now moving the message back form the imported mailboxes to their original spots.

    this seems to have worked, but I'm worried that I have another full copy of all the mail sitting in my mailbox that isn't being used, and its not clear of what to erase... not that hard drive space is an issue, with 250 GB, but its still seems a bit wasteful to have 5 GB of extra mail hanging around that I can seem to figure out how to get rid of. The backup (real) copy of my mail from my old computer is 4.58 GB and my current new mail folder is now 10.54 GB.

    Ideas? The only one I've had is to do this process again, but to wipe the mail folder and re-establish the accounts fresh before importing. If you have an easier way, let me know.

    thanks, Dave
  • 3. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    Guychi Level 1 Level 1 (0 points)
    I've solved my problem:

    It turns out there were a few culprit messages that when trying to import them Mail.app would crash. These were usually messages with attachments that had filenames containing both non-ascii characters AND digits. But this may not be the only criteria.

    To identify which are the culprit messages and remove them, go into the mailbox folder from which Mail is importing last when crashing, and remove the first file (when sorted in ascending order by name) from the Messages folder inside it.

    Repeat as necessary for each successive culprit.

    That's it!
  • 4. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    Daniel Warne Level 1 Level 1 (50 points)
    I'm also having this exact problem. Mail tells me "Mail needs to import your messages. This might take a few minutes, and you won't be able to use Mail until the import is finished. Click continue to import your messages now, or click Cancel if you'd rather do it later."

    Clicking continue starts the import process -- of my 170,000 -- emails. Mail reliably gets to 88868 messages, then the number stops counting upwards and the progress bar no longer progresses.

    Watching Mail in Activity Monitor I can see that Mail starts rapidly consuming more and more memory until it fills the system memory entirely (on my MBP with 4GB RAM) and then crashes out.

    Like the previous poster, I suspect there is a particular message causing Mail to crash or go into a memory leak loop, however, it's very difficult to identify because the crash report Mail generates (along with log info in Console) doesn't mention any specific messages it is importing.

    It's clearly a memory leak problem of some sort because Mail consistently sits at 212.94 MB of active RAM usage while importing the mail up until the point it crashes, after which time it uses about 40MB a second until it fill system memory.

    I tried using the LSOF command to monitor what files Mail was opening each second, however when it goes into its "rapid memory consumption about to crash" mode, I can see that it is continuing to open different mail messages, so it is not clear which one I'd have to delete to fix the problem.

    So I am a bit stumped. I can work around the problem by hitting cancel when Mail says it needs to reimport the mail, but then I can only receive new mail, as none of my existing mail is listed in Mail. Very annoying.
  • 5. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    Guychi Level 1 Level 1 (0 points)
    If you read again my previous post carefully you'll find the solution to identifying the problematic message.
  • 6. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    Daniel Warne Level 1 Level 1 (50 points)
    Thanks I did see your message. However, I couldn't see how deleting the first message in a folder of messages sorted alphabetically would help things... Apple Mail isn't deleting the messages in the folders, after all... so you'd simply be deleting the first message in the folder wouldn't you?
  • 7. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    Guychi Level 1 Level 1 (0 points)
    Mail isn't deleting them, but moving and renaming them into another temporary folder while importing. And it does so in an alphabetical order.

    Thus the first unmoved message is the culprit.

    Just make sure you've got the mailbox right.
  • 8. Re: Mail.app not restoring properly - keeps asking to import mailboxes, cra
    Toad999 Level 1 Level 1 (0 points)
    I just got my new MBP17 (4GB,250) and Migration Assistant copied things over from my old MBP Time Machine Backup.

    I am seeing the same problem. My question is: why did Mail.app decide it needed to import anything at all ? Why didnt it just start up with the copied over settings, prefs, mailboxes etc. as if nothing had changed ?

    Very annoyed since mail is kind of a must have application. Stuck in limbo between not being able to use the new machine until this f**up is cleared and not wanting to use the old one any more because then I get progressively out of sync if I still do mail on that...

    grrr- tearing out gray hair...
  • 9. Don't do it, just restore the prefs file
    Gabriel Radic Level 1 Level 1 (5 points)
    If Mail pops the message about +existing mail messages need to be imported first time you use Mail+ it's because its preferences file is corrupt. To fix the problem, restore the mail preferences file from a backup and you're all set. You'll find it here ~/Library/Preferences/com.apple.mail.plist.

    It just happened to me: the mac crashed, mail stops working after reboot, restored preferences from a time machine backup, relaunched mail... all's fine.

    (I first just deleted the preferences file, but that will reset all the accounts. This may result in losing the messages in the special Inbox, Outbox and other special folders. Go with the restore.)
  • 10. IMPORTANT: Rebuild your mailboxes
    Gabriel Radic Level 1 Level 1 (5 points)
    It may be necessary to rebuilt your mailboxes before things get back to normal.
    http://www.macworld.com/article/56673/2007/03/mailfix.html