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

Sep 30, 2012 1:00 PM in response to Brian Smith5

I ended up updating my old iMac to Mountain Lion and then the rules on that computer synced with the rules on the new computer over iCloud, so I think that it was definitely a syncing issue that kept me from changing the plist. I think that maybe following Robert Nicholson1's suggestion above (modifying the UnSyncedRules.plist) may have worked too, but I had already made the software update on my other computer.


Thanks for all of the info here though!

Oct 8, 2012 4:02 PM in response to lotdrops

Having lots or rules hate typing I knocked up a little java program to do the edits, use at your discretion ...


import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.io.PrintWriter;



public class MLRules {


/**

* Copy old rules from MessageRules.plist as per

* https://discussions.apple.com/thread/4139498?start=15&tstart=0

* as follows

* copy SyncedRules.plist to SyncedRules.xml

* insert old rules

* Run this program

* copy UnsyncedRules.plist to MailData directory

* NB The usual health warnings come with this program

* Your mileage may very - no warranty expressed or implied

* Use at your discretion

*

* @param args

*/

public static void main(String[] args) {

File in = new File("SyncedRules.xml");

File out = new File("UnsyncedRules.plist");

PrintWriter pw = null;

try {

FileReader fr = new FileReader(in);

BufferedReader br = new BufferedReader(fr);

pw = new PrintWriter(out);

String inline;

while( ( inline = br.readLine()) != null ) {

if ( inline.trim().equals("<key>Active</key>")) {

br.readLine();

} else if ( inline.trim().equals("<key>TimeStamp</key>")){

pw.println(inline);

inline = br.readLine();

if ( inline.startsWith("<string>") ) {

String newline = inline.replace("string", "integer");

pw.println( newline );

} else {

pw.println(inline);

}

inline = br.readLine();

if ( inline.trim().equals("</dict>") ) {

pw.println( " <key>Version</key>" );

pw.println( " <integer>1</integer>" );

}

pw.println(inline);

} else {

pw.println(inline);

}

}

} catch (Exception e) {

throw new RuntimeException(e);

} finally {

if ( pw != null ) pw.close();

}

}

}

Oct 9, 2012 6:54 AM in response to Robert Nicholson1

Robert Nicholson1 wrote:


Here's all I had to do...same edits as suggested but copy MessagesRules.plist to UnSyncedRules.plist

and the rules returned and it remembers which ones were enabled/disabled from before.

Thanks Robert that worked for me, I had almost given up hope and thought I would give it one more attempt before I loose any more hours trying to save them.

Nov 5, 2012 12:34 AM in response to lotdrops

It' amazing what users have to come up with to do Apple's homework!


The solution for adding the lost/non-synced rules in ML mail was



copying all of the

<dict>...</dict>
items from my old
MessageRules.plist
and added them to:

~/Library/Mail/V2/MailData/UnsyncedRules.plist

When I launched Mail.app again, they were in my rules, but disabled. One click on each and they ran fine.

Thanks to all those who used their brain in favor of Apple Corp.

Nov 7, 2012 1:20 AM in response to lotdrops

For me this list of symptoms (losing rules, smart mailboxes, and signatures) was triggered by turning on iCloud on a different/new Mac. Seemingly iCloud sync processing somehow decided that the limited set of files it tries to synchronise for Mail were more up to date on the new machine and so those files got pushed to the original/old Mac. (Both machines were already on Mountail Lion.)


With thanks to various posts in this thread I seem to have got back to where I was by:

  1. Closing Mail
  2. Turning off Mail in the iCloud System Preferences pane
  3. Renaming/deleting SyncedFilesInfo.plist (inside ~/Library/Mail/V2/MailData)
  4. Using Time Machine to retrieve: Sigantures folder and various plist files (Signatures,SmartMailboxes,SyncedRules,SyncedSmartMailboxes,UnsyncedRules...)
  5. Opening Mail
  6. Re-checking the rules within Mail preferences.
  7. Crossing fingers, closing Mail, reopening Mail, sighing with relief 🙂

Dec 27, 2012 1:55 PM in response to siamless

I had the same problem when setting up a new 10.8x ML iMac with a fresh restore from my 10.6.8 MacBookPro Time Machine backup. Most things worked out, but my Mail Rules did not transfer, and I have hundreds of them. Sure I could re-create them, but I'm not really one for re-doing work that's already been done.


The following instructions only work if you have access to your 10.6x user Library, or a backup of your original 10.6 user Library and Mail folder (ala Time Machine or whatever), but it's pretty quick and easy.


Quit out of Mail completely on the 10.8 machine.


From your 10.6 machine or backup of your 10.6 user diectory, open the Message Rules plist file into Text Edit or another editing program (/Users/username/Library/Mail/MessageRules.plist)

.


Select & Copy the desired "user defined" only entries (very important) between

<dict>...</dict> (if you have a lot of rules, you might want to test this with a single entry first)


Open the UnsyncedRules.plist file in 10.8 mail. *Hint, to open the hidden user Library folder in 10.8, navigate to any open folder and from the Finder, hold the Option key down and select Go > Library from the Finder Menu.


Next, navigate to the file using the following path

~/Library/Mail/V2/MailData/UnsyncedRules.plist 

Between the last </dict> and the last </array> in the UnsyncedRules.plist file, paste the copied code from your MessageRules.plist file.


Save your changes.


Open Apple Mail and navigate to your Mail Rules in Preferences. You should now see all of your Rules. Check the select box next to each to activate the rule.


*Note. If you still only see the default rules you may have copied some non-user difined rules, or you may have had Apple Mail open when trying to save the changes to the file, either of which appear to cause the file to be reset back to the default. If you re-open the UnsyncedRules.plist file and none of the code you pasted is there, you can assume you copied and pasted the code incorrectly. Try again using a single rule entry. If the process works for one entry, carefully select additional entries and repeat the process.


Interesting side note, and I'm sure there's a genius here that knows specifically what's goin on, but once you successfully complete the above procedure, if you quit mail and re-open the UnsyncedRules.plist file, you'll see that it is once again clear of the user defined entries you added even though your rules are appearing properly in Mail Preferences. If you open SyncedRules.plist however, you will see that they now appear in this file instead. I'm sure there's some logic to it, I just know it worked, and saved me a LOT of time. Hopefully it works for you as well.


Message was edited by: blainetransue

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.