Wednesday, February 19, 2014

Getting Apple Mail's Smart Mailboxes to remember Outlook Exchange folders

I've been trying to get Apple Mail's Smart Mailbox to look inside my Outlook Exchange folders for mail and for whatever reason, the Smart Mailbox doesn't seem to be able to remember the Exchange folder I selected.

For example, I have created a folder named test in my Exchange account.  I then created a Smart Mailbox named Test Mailbox to look at this folder:


After I click OK, and go to edit the Smart Mailbox again:


Ah! Where did my folder go?  I've tried googling various combinations of terms to get information, and I've come across a couple of posts on Apple's forum, but nothing that points to a solution or a workaround.

I initially started down the path of creating a Smart Mailbox with the following filters:
1) Look for Messages not in Mailbox and select Inbox
2) Build a complex filter that is the same as the rules being applied to move messages to the desired folder

It turns out I needed to build some complex filters (combinations of OR and AND) which the dialog doesn't allow for.  The dialog only gives the option of doing one or the other.  I stumbled across this post that helped me build some more complicated filters.

One thing I'd like to point out is that the folder & file name has changed since the post:

[User]/Library/Mail/V2/MailData/SyncedSmartMailboxes.plist

** CAVEAT: Please be sure you back up any of the *.plist files you are going to play with in case things go horribly awry. **

After playing around with this for awhile, I got curious as to why Apple Mail wouldn't remember my folder.  So I re-created the Smart Mailbox named Test Mailbox to look in my Exchange folder test and then I looked in the file and searched for this Smart Mailbox:


And that long garbled string is the problem. For whatever reason, the destination mailbox URL gets completely mangled.

The next thing to do is to find out what the actual destination mailbox URL is.  I happen to have rules in Mail that are applied to incoming messages which filter my email into the various folders.  This file lists these rules:

[User]/Library/Mail/V2/MailData/SyncedRules.plist

I searched this file for my Test folder and found a not garbled URL to my folder:


Copy this URL and paste it in place of that garbled string:


And ta-da!  I now have a Smart Mailbox that is looking inside my Exchange folder.

To summarize:
1) Create a rule that moves emails to the desired folder.
2) Create a Smart Mailbox, as you normally would, pointing to the desired folder and any other conditions.
3) Search the [User]/Library/Mail/V2/MailData/SyncedRules.plist file for the desired folder and look for the CopyToMailboxURL key.
4) Copy the URL under the key.
5) Search the [User]/Library/Mail/V2/MailData/SyncedSmartMailboxes.plist for the new Smart Mailbox.
6) Paste the URL over the garbled string.

Enjoy!

3 comments:

  1. I really impressed and enjoy reading this. Thanks for posting like this.Good job! Whitehall Mailboxes

    ReplyDelete
  2. You're welcome Daniel ... sorry it took so long to acknowledge your comment, I need to tweak my notification settings :)

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete