iCloud syncing of Mail.app rules and Smart Mailboxes

Setting the context

I run Mail.app on an internet-hosted Mac mini, in order to provide server-side spam filtering and to pre-process my email based on an extensive set of rules.

Many of those rules involve the application of tags to messages, via the wonderful MailTags plugin.

On the MacBook Air that I use at home and at work, I have a simple set of four rules that apply account-specific colors to incoming messages. On the other hand, that MBA does contain an extensive set of Smart Mailboxes, most of which search for messages containing certain tags.

Problems archiving and deleting inbox messages

I’ve been having awful problems recently with Mail.app’s ability to delete and archive messages in my inbox. I’ll archive a message, only to see it return 10 minutes later. I’ll archive it again, and it’ll again return sometime later.

If I then view my inbox on an iPad, however, I’ll see four copies of that message in the inbox! If I then delete them all from the iPad, the pesky original message will then be removed from the inbox on the Mail.app.

This has been driving me crazy!

An aside—Why am I seeing four copies?

Mail.app on OS X has an annoying behavior of only showing you one copy of duplicate messages; so in fact, there are four copies of the message in the inbox, but Mail.app is only showing me one.

That’s how four messages somehow get created. The first time I archive the message, a second copy gets created. The second time I try to archive, two additional copies get created.

Disappearing Smart Mailboxes & Rules

In an attempt to fix this irritating behavior, I uninstalled the MailTags plugin, which is currently in a beta version for OS X Mavericks. Most probably MailTags has nothing to do with it, but since it’s beta software, I thought I’d give it a try.

After uninstalling MailTags on my MacBook Air and launching Mail.app, I observed my entire list of Smart Mailboxes simply disappear—replaced by a single Smart Mailbox, “Today”. Re-installing MailTags, all my Smart Mailboxes returned.

After uninstalling MailTags on the mini and launching Mail.app, I opened the preferences to find all my rules gone, and replaced with the four simple rules I have on my MacBook Air!

What’s going on here?

I emailed the folks at MailTags, and learned that MailTags keeps its own local database of Smart Mailboxes and Rules, so that if you launch Mail without MailTags installed, no rules or Smart Mailboxes will get created that contain tag-related rules.

Ok, that explains why things change when MailTags is uninstalled.

What’s strange, though, is that before uninstalling MailTags, I’d removed all the tag-related criteria in my various Smart Folders, and still they all disappeared after uninstalling MailTags. So, evidently, once a Smart Mailbox (or rule) makes its way into the MT local database (because of tag-related criteria), it’s not moved to the local Apple database if you later remove those tag-related criteria.

iCloud’s role in the mess

How is syncing entering the picture?

I did some research and learned that if you have Documents & Data enabled in iCloud, any Mail.app rules and Smart Mailboxes you create will get synchronized across all your Macs.

That’s terribly undesirable behavior for someone like me, who specifically needs different sets of rules and Smart Folders running in Mail.app on each of my Macs. And according to this article the only way to stop this behavior is to disable Documents & Data in iCloud.

I was going to do just that, when I saw 1Password in the list of apps using Documents & Data—and that’s the one app that I need to sync data across all my apps. So unless I’m willing to move 1Password syncing back to Dropbox, it looks like I’ll be stuck with syncing of Mail rules and Smart Mailboxes.

Unless… I keep MailTags installed. Remember, when MailTags is running, Mail.app’s Smart Mailboxes and rules are created from MailTags local database, which is not synced.

But with MailTags running, I’ll not be able to figure out whether it’s playing a role in my inability to delete/archive certain messages from my inbox—which is where this all began. So I’m kinda stuck.

5 thoughts on “iCloud syncing of Mail.app rules and Smart Mailboxes”

Dear Matt,
Have you resolved this issue? I do not have MailTags as far as I know (never installed it). I recently started my iCloud to sync my contacts between my phone and mac. I do not sync my mail. However, I found turning on/off iCloud has killed all my smartmailboxes. Frustration ensues. I thought perhaps you found some general solutions that may help me.
Thanks,
Andre

Hi Matt,
For now, I just pulled the rules/smartmailboxes back from TimeMachine.
I only use iCloud to sync my contacts/calendars. For calendars, I can just use google to run, leaving me with only contacts to worry about. Do you know an alternate syncing software for contacts? What is quite frustrating (as you know), I did not have iCloud touch my mail, yet somehow it broke it anyways.

Hi André, I don’t know of another contacts syncing solution, except for perhaps Google Contacts. I use iCloud for contact syncing myself. With the exception of the Mail rules/smart-mailbox syncing issues, I’ve otherwise been happy with iCloud for everything else.

Not sure if you’re still experiencing this. I just ran into the same issue myself, today. Easy work around is to use the “Synchronized Folder” option for MailTag sync instead of iCloud. You can then easily back the files (just a bunch of plists) or set the “gold” master to Folder sync, then set the problem child to folder sync afterwards and overwrite its settings.