Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

How to thoroughly trim Mail's mailbox sizes Apps
Something I've figured out, after suffering from Mail's dreaded "missing message" error:
The message from [name/address] concerning [title] has not been downloaded from the server. You need to take this account online in order to download it.
To resolve this problem, this recent hint works very well. But in my case, further 'clean up' steps seemed to be needed. I've tried out the following steps on my mail, and it really tidies up and speeds up Mail's performance, and saves a lot of disk space too! Please note that this method will remove any attachments on messages in the mailboxes you clean up...

Open up a mailbox (turn on the Attachments column first), and then sort by Attachment. Or just select all (Command-A), and strip all attachments from all messages in that mailbox. Select all the files with attachments needing to be stripped, and under the Message menu, select Remove Attachments. Once that's done, it seems there's some rather odd behaviour in Mail. At this point, if you were to use the Mailbox: Rebuild command, all the attachments seem to "come back." Strangely, no file-size improvement is seen, even if you do not do a rebuild. However, continuing on...

Create a new mailbox (with the same name, but just add a "2" or something on the end of the new name). Select all of the messages (Command-A) in the "old" mailbox. Use the Message: Copy To menu command, and copy all the messages into the new mailbox you've just created. Note, do not use the Move To command, as that doesn't seem to work properly -- it's probably just linking the old files to the new location, like an alias.

Switch to the new mailbox, and do a Mail: Rebuild command on it. In the Finder, the new folder's file size decreases dramatically, and general responsiveness of that new mailbox within Mail appears to be much faster. After doing all that, you can delete the "old" mailbox. Finally, rename the new mailbox (control-click on the name of the mailbox, select Rename Mailbox, and delete the "2" on the end of the name of the new mailbox). You want to restore the exact same name as the old mailbox had. This will insure that any rules/filters you have previously created that point to that mailbox will not get "confused" by encountering a different mailbox name.

I've done this to all (over 200) of my mailboxes, for all my various clients and topic mailboxes. This has trimmed out over 85% of the total file size of my Mail folder, and Mail seems to be dramatically faster doing mailbox opening and searching.

Important Note: If you want to keep any of the attachments, particularly on incoming mail, where people are sending you files that you do not otherwise have on your hard drive, you should extract them from the messages first, and save them in a file folder on your hard drive -- not "attached" to mail messages! Only then proceed with the "stripping" of the attachments from the mail messages in (whichever) incoming mailbox is getting the "overhaul."

The final chore is to sort out your "Rules" list, and trim out any rules that point to "non-existent" (deleted) mailboxes. After that, you're done!
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)

How to thoroughly trim Mail's mailbox sizes | 6 comments | Create New Account
Click here to return to the 'How to thoroughly trim Mail's mailbox sizes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Simple Situation; no Simple Solution?
Authored by: GammaRay Rob on Feb 24, '06 09:28:16AM

The quoted error message from Mail arises most often in the one situation I want to accomplish simply: I back up my Work computer's Mail account on my iPod, copy the backup to my laptop, and, presto, no luck: "...the mail is on the server...". While I have my suspicions why Mail might be constructed this way, it would be really nice if I could keep a complete and functional backup of my Mail archive on my laptop. Is there no simple solution for this?
GammaRay Rob

-- This line no sig

[ Reply to This | # ]
Simple Situation; no Simple Solution?
Authored by: dotgray on Feb 24, '06 04:33:20PM

For the Mail that you've trying to archive, are you copying from a system running Mac OS 10.3.x or 10.4.x? Apple changed the way mail is stored in Tiger (to support Spotlight indexing without having to write an extra plug-in), so the cause of this error message is slightly different.

[ Reply to This | # ]
Try mailsteward
Authored by: jim_perry on Feb 25, '06 09:15:20AM

Mailsteward basically backs up your mail into an sqlite database. It's not particularly elegent, but does work and is fast for archiving years worth of mail.

-- sig --
The early bird gets the worm, but the early worm gets eaten!

[ Reply to This | # ]
How to thoroughly trim Mail's mailbox sizes
Authored by: syzygies on Feb 24, '06 11:04:02AM

I recently had to delve far deeper into this than I would like. Ten years of my email had distinct geological layers by organizational regime. Now, when my hero Steve Jobs isn't trying to be known as the guy who killed the album, he promotes this brilliant idea that one's file organization shouldn't matter; let Spotlight do the heavy lifting. This more or less works with "Smart Mailboxes" in Mail, except for the annoying delays each time the Smart Mailbox rebuilds. A better program design could hide these rebuilds from the user, caching views and rebuilding incrementally. But, hey, this is Spotlight v.1.

Anyhow, I decided to rearrange my last few years of email into a "year, month" folder structure. Every time Mail hit a missing message, I'd get the error described in this post, aborting the copy. Unfortunately, this aborted the delete phase for the messages already copied, producing thousands of duplicate messages. Worse, one couldn't simply use a duplicate hunter to fix the problem, as Mail writes a field into its XML at the end of each message recording its last folder (perhaps to be used in the delete phase that-wasn't?).

To fix this, I used BBEdit to standardize these XML fields to some bogus home planet, then I used a duplicate hunter to remove duplicate messages. It was a huge, time-consuming mess. I reported this bug to Apple.

One should study the individual message format to make educated guesses as to what Mail is doing, rather than trying to make sense of Mail's functional behavior. In particular, attachments are stored in each message, and also sometimes in a folder Mail sets aside. A bit of experimentation could sort out what actually happens when one tells Mail to delete attachments. My impression is that the copy in each message weathers any storm short of deleting the actual message file.

This is all ripe for a Perl script; I'd like to remove duplicates without being fooled by Apple's variant XML comments, and then sort all 10 years of mail into year, month folders, using Perl to parse the date field in each message, fixing bogus date fields. Unfortunately, Mail isn't scriptable, so the rebuild mailboxes phase would need to be carried out by hand.

[ Reply to This | # ]
How to thoroughly trim Mail's mailbox sizes
Authored by: sjk on Feb 27, '06 02:36:29PM
Maybe this is partly helpful:

emlx to mbox Converter

And formail.

Btw, Mail is definitely scriptable.

[ Reply to This | # ]
How to thoroughly trim Mail's mailbox sizes
Authored by: dancingbrook on Jul 10, '07 11:46:20AM