Smart Mailboxes disappeared one day randomly (I think is due to iCloud-Document and Data Sync), or when creating new smart folders. If that is the case, I have checked these two files and discovered the following:
SmartMailboxesLocalProperties.plist (no change required in this file)
I found that the data and filter rules are all intact, what is causing it not to show is due that the value for "mailbox type" is incorrect.
Open up SyncedSmartMailboxes.plist,
for more technical savvy people (can do a find/replace), ensure this for relevant mailboxes:
<integer>0 or 7</integer>
7 - top level smart mailbox/folder
0 - sub level smart mailbox/folder
<integer>1 or 2 or 17 or 18</integer>
*sub - any level that is non-top,
One of my smart mailbox within a smart folder has its <key>MailboxType</key> set as 7, which is incorrect. That's why it "disappeared" in mail osx.
By changing it to '0', the smart mailbox reappear upon mail launch.
Losing all my smart mailboxes on my home iMac was a combination rceiving an new Macbook Pro with System preferences -> iCloud:
1) Documents & Data checked -- so I could sync Preview docs and the like
2) Mail turned off -- because I don't want to mix up the Mail accounts used on both machines
As a result, iCloud sync'ing kept wiping out my iMac smartmailboxes with the (empty) smart mailboxes on the MacBook
To fix this, I copied over contents between two files on my home iMac, using a Time Machine backup of SyncedSmartMailboxes.plist:
to: ~/Library/Mobile Documents/com~apple~mail/Data/MailData/ubiquitous_SyncedSmartMailboxes.plist
I've also filed a suggestion with Apple that smart mailbox info should be stored with the iCloud -> Mail setting, and not iCloud -> Documents & Data.
Thank you! That was a total help. I discovered that my ~/Library/Mobile Documents/com~apple~mail/Data/MailData/ubiquitous_SyncedSmartMailboxes.plist was 0 bytes. I overwrote this file with the locked file I've been using, and so now each launch of Mail just gives me this file instead of the 0 byte one it had.
On your suggestion, I disabled iCloud sync for Documents & Data. This allowed me to make changes to my Smart Mailboxes. I then backed up the file (because iCloud) and turned on Documents & Data syncing and relaunched Mail. To my surprise, it had the updated smart mailboxes; however, not to my surprise, any changes I make are once again lost.
So, at least now there is a cockamamy work-around should I need to update my smart mailboxes.
I added the same request to my radar bug report that these settings should be part of the iCloud -> Mail setting instead of Documents & Data.
I've been on Mavericks since it was released. Suddenly, today, experienced a variation of this disappearing smartboxes problem—the one where they're all replaced with one smartbox named "Today."
The Patrick Gibson solution worked for me. My SyncedSmartMailboxes.plist file is now locked, but my smartboxes have all returned.
The following solution just worked for me. No need to turn off Documents & Data in the iCloud control panel.
You do need an older copy of the file,
because the current is basically empty, destroyed by an evil Apple mistake. I found my file in yesterday's TimeMachine backup (yay, Apple!).
It seems the file,
maintains a list of sync'd files.
1) Quit Mail
2) Deleted the final entry in the file
which looks like this:
<key> a bunch of stuff</key>
<dict> a bunch of stuff </dict>
3) Start mail app, and voila! the smart folders are there.
Hope it works for you!