Lost mail rules when upgrading to ML, can't restore from time machine

Hi,

I've installed mountain lion and restored from time machine and mail rules were not there. There's only news from apple.

I tried to restore the rules myself (MessageRules.plist and MessageRules.plist.backup) but when opening mail rules were not there yet. Nevertheless, i can add rules manually, so if there was a way of looking at the past rules I could just copy them (though it's not the best way).

Apple Mail-OTHER, OS X Mountain Lion

Posted on Jul 26, 2012 3:51 AM

Reply
55 replies

Aug 1, 2012 3:32 PM in response to Casemon

In MessageRules.plist (Snow Leopard) from 21st June, when opened in Text Edit, the start of an individual rule looks like:

<dict>
<key>Active</key>
<string>1</string>
<key>AllCriteriaMustBeSatisfied</key>
<string>NO</string>

In SyncedRules.plist (ML), today the identical rule starts:

<dict>
<key>AllCriteriaMustBeSatisfied</key>
<string>NO</string>

(the grid appears here when copied from Text Edit)

so the first two lines need to go (There're at the bottom of the rule in ML).

The same rule ends (old SL file)

<key>ShouldTransferMessage</key>
<string>NO</string>
<key>TimeStamp</key>
<string>291341289</string>


and the new one:

<key>ShouldTransferMessage</key>
<string>NO</string>
<key>TimeStamp</key>
<integer>291341289</integer>
<key>Version</key>
<integer>1</integer>
</dict>

Note change from <string> to <integer> and the added two lines, which seem to be a new version of the two that were at the top of the older rule, also with a change from <string> to <integer>. The "1" in this seems to be the same in all rules.

This alteration should be fairly easy to do, using Find & Replace, if done in the right order.

Aug 2, 2012 1:40 PM in response to lotdrops

Done! All Rules, Smart Mailboxes & Signatures all now restored from Lion to Mountain Lion!


To sum up the manual process:


  1. Quit Mail 🙂
  2. Mail Rules; as mentioned by Karabuni above:
    1. copy manually from ~Library/Mail/V2/MailData/MessageRules.plist all <dict> entries under root node "rules" to ~Library/Mail/V2/MailData/SyncedRules.plist,
    2. remove the Active key & string
    3. ensure TimeStamp value is integer (not string).
  3. SmartMailboxes; similar to above:
    1. manually copy <dict> entries from ~Library/Mail/V2/MailData/SmartMailboxes.plist to ~Library/Mail/V2/MailData/SyncedSmartMailboxes.plist
    2. ensure you copy into in the "mailboxes" array (2nd array in my SmartMailboxes.plist).
  4. Signatures; a little more involved:
    1. open ~Library/Mail/V2/MailData/Signatures, then open SignaturesByAccount.plist and copy all <dict> entries in the AllSignaturesKey array. Paste that into the array in AllSignatures.plist.
    2. Next Open AccountsMap.plist and copy the SignaturesUniqueID <string> (ex: <string>2487A222-2ECF-43CF-AFE8-6FB0F400C1F6</string>) into the Signatures array for the account you want the Signature assigned to. That will get the entries to appear in the Preferences, but no content if adding to a mail.
    3. Open all .webarchive files in ~Library/Mail/V2/MailData/Signatures in Safari and copy the content of each 1 by 1 into Preferences->Signatures (copy and paste into the corresponding signature).


Hope this helps!!

Aug 2, 2012 1:46 PM in response to stoikr

@stoikr

Follow the steps and you'll be fine; you DO NOT HAVE TO SETUP ALL RULES again.


As to your criticism... ok, they missed this one for some people, but isn't it still true that most things Apple "just work"?


Let's put this into context: Apple has succeeded with an approx. 99% seamless transition to Mountain Lion for most users, an upgrade that adds hundreds of new features, increases feature parity with mobile devices, etc. and yes they missed less than 1% of bugs...


Don't you think it a little unreasonable to expect it to be 100%? If not, do you expect the same exacting performance from yourself in your work? 🙂

Aug 2, 2012 11:45 PM in response to lotdrops

I just used BBEDIT to print the file at (Library/Mail/V2/MailData) (the plist file). Then I looked through it for my 15 rules and since 7 no longer apply (chaff) I just re-created the remaining 8 manually. Yes, this is a pain in the rear but this was quicker. Thank goodness I didn't lose my sigs. I usually title my rules with what the rule does, example:


FORWARD somemail@somedomain.com TO anothermail@anotherdomain.com [STOP]


This tells me what the rule does and that it stops evaluating after the rule is executed. Doesn't always work if there are a lot of conditions, etc. but in this case it worked just fine. Is it just me or does it seem that the rules for the iCloud accounts work OKAY? I don't use iCloud on my primary email and the rules were lost.

Aug 8, 2012 11:30 AM in response to lotdrops

I also found my rules were blank when I migrated from Lion to Mountain Lion. Given I have over seventy rules, recreating them by hand would have been nightmarish. Here's the steps I followed to restore my missing rules:


1. Be sure Mail is _not_ running.


2. Copy ~/Library/Mail/V2/MailData/MessageRules.plist to ~/Library/Mail/V2/MailData/SyncedRules.plist.txt


3. Edit SyncedRules.plist using a _text editor_.


4. Delete the following lines from below the "<plist version="1.0">" line:


<dict>

<key>rules</key>


5. Delete the following lines from above the "</plist>" line at the end of the file (your integer value will almost certainly be different than '999'); be sure not to delete the "</plist>" line at the end of the file:


<key>version</key>

<integer>999</integer>

</dict>


6. You will now need to adjust the indenting of the plist to account for the deletions you've made. We can use plutil to do this for us. From the Terminal, run the following command (this should be _one_long_line_):


plutil -convert xml1 ~/Library/Mail/V2/MailData/SyncedRules.plist.txt ~/Library/Mail/V2/MailData/SyncedRules.plist


7. Start mail.


8. Your mail rules should now be restored, except all will be marked inactive. You will have to re-activate them by going into Mail's preferences (Command-,), clicking the 'Rules' button in the toolbar, and then clicking the checkbox to the left of every rule. If you have a bunch of rules, this is made easier by clicking the first rule to highlight it, and then alternating between pressing space and the down arrow on your keyboard to check the checkboxes for each mail rule.


9. Once everything works, feel free to delete ~/Library/Mail/V2/MailData/SyncedRules.plist.txt .


Hope this helps.

Aug 18, 2012 8:28 AM in response to lotdrops

This is very strange since neither solution worked for me not the one by Karabuni or that of SolomonFord, but nonetheless thanks for your input.


Strange thing is that the timestamp from MessageRules.plist in my case was already an integer and not a string.



[edit]


Now i see why timestamp is integer and not string.


I did an update from Lion to Mountain Lion and not from Snow Leopard. Even did a clean install and then retrieved the data back from my TimeMachine backup.


[/edit]

Aug 20, 2012 11:57 AM in response to lotdrops

After trying all of the above and several similar suggestions, what worked for me was to remove the SyncedFilesInfo.plist file. I should note that my problem occurred when I signed out of my iCloud account.


Keeping files open in TextWrangler revealed that backups were erased on mail launch, so I presumed it had something to do with a cached file or account settings. After running YASU and some other utilities with no positive results, I was about to delete accounts and start over on mail (I have a lot of rules). I noticed that the file mentioned above was being modified on startup so I peaked inside it and sure enough it had a number or iCloud references. I removed it, launched mail and all back to normal. I had alread replace my signatures, but I bet it would have restored them as well. But rules and smart mailboxes were all back to normal.


Hope this helps others.

Aug 31, 2012 3:29 AM in response to michael.bigley

Thanks to SolomonFord and michael.bigley I now also have recovered all the rules I had built in several months.

Only, the correction of the indenting SolomonFord suggests is not necessary. In XML indentation is not an issue.


It is a shame that this is the second blunder Apple made regarding the Mail App. They removed the RSS-reader without any notice and all the feeds were just gone. 😠


I switched from Windows to Apple last year and I was very happy about it, but now I don't know how I am going to tell this stupid mistake to all the people I am trying to convince to switch to Mac OSX as well. 😕

Sep 13, 2012 7:04 PM in response to SolomonFord-OhioState

SolomonFord's solution worked for me, but I had to tweak it slightly.


Instead of (note bold) --


plutil -convert xml1 ~/Library/Mail/V2/MailData/SyncedRules.plist.txt ~/Library/Mail/V2/MailData/SyncedRules.plist


I found that I needed to use --


plutil -convert xml1 ~/Library/Mail/V2/MailData/SyncedRules.plist ~/Library/Mail/V2/MailData/SyncedRules.plist


Without removing the .txt extension, the terminal command returned an error.

Sep 16, 2012 12:43 PM in response to michael.bigley

Hey, thanks for figuring this out. I gave it a try, but a new SyncedFilesInfo.plist keeps getting generated, possibly through iCloud syncing. I tried even just deleting the code for syncing the SyncedRules.plist from the SyncedFilesInfo plist, but this again got overwritten. I can turn of iCloud syncing of Mail, but then that gets rid of my iCloud mail account altogether. I guess that they really are forcing me to update all of my computers to MountainLion so that things can be synced across. LAME. I got a new computer that came with ML, but am not ready to prep my older computers for the update (they are on SL). In the meantime, it would be nice to have my Mail Rules working, especially since I have just spend a couple hours trying to follow the directions above (which I think are good, but just keep getting undone by "syncing").


Apple Fail.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Lost mail rules when upgrading to ML, can't restore from time machine

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.