Back in Mac 101’s long-ago days when we were first getting our feet wet with the Finder, I introduced you to smart searching—the process of creating a series of conditions that would display matching files in a list. For instance, you might set up a list of JPEG image files that were over a megabyte in size. As I explained at the time, the idea of stringing together conditions to filter the information you see is a concept that runs throughout Mountain Lion.
One area where this concept is apparent is in Mail’s rules. But rather than using such conditions to deal with files already on your Mac, more often than not, you employ rules to sort your email as it’s delivered to your Mac. Just as an example, let’s apply this idea to the real-life paper mail that we still receive from time to time.
When you open your physical mailbox at home, you find all your mail bunched together—catalogs, magazines, letters from your Auntie Di, bills, advertisements, and Netflix envelopes. Now imagine, instead, opening that mailbox and finding your most important mail (say, envelopes stuffed with money) right up front, personal correspondence that you care about in a little bin to the right side, your Netflix envelope in yet another bin to the left, magazines sitting in their own container near the back of the box, and any junk mail reduced to a bare few ashes. Far more convenient, yes?
Without giving your postal carrier a very generous holiday tip, that kind of thing just isn’t going to happen. But you can accomplish the equivalent in Mail.
Looking at rules
Launch Mail and choose Mail > Preferences (or press Command-comma). In the resulting window select the Rules tab. By default you should see a single entry: News From Apple. Let’s create a rule of our own by clicking the Add Rule button.
When you do, you get a sheet that includes a Description field, some pop-up menus, and Plus (+) and Minus (-) buttons. The sheet has two major sections. Under the Description field is the If area. The items here are the conditions that must be met for the rule to do something. For instance, an acceptable condition might be If From Contains bubba@example.com. With this If condition, any messages sent from that address will be manipulated by the actions you create beneath. For example, in the ‘Perform the following actions’ area, you could configure the action Set Color of Message of Text to Red.
Click OK, and Mail will ask if you’d like to apply this rule. Once you indicate your agreement by clicking Apply, any existing messages from Bubba will be colored red in the Message Browser, making them easy to identify. This is great, but better yet is that any future messages from Bubba will also be colored red. And that’s the power of rules—preemptively sorting your email so that you don’t have to do it manually.
That’s largely it: Create conditions that keep an eye peeled for specific existing and incoming messages, and then do something with the email that arrives.
Some helpful Mail rules
I don’t want to leave you entirely on your own at this point, so let’s make a few helpful rules.
Filtering mail to another folder: You’ll use a rule like this fairly frequently to file your email automatically so that it doesn’t junk up your inbox.
Start by choosing Mailbox > New Mailbox or by clicking the Plus (+) button at the bottom-left corner of the Mail window and choosing New Mailbox from the menu that appears. In the New Mailbox sheet that comes up, select On My Mac from the Location menu, type in a name such as iTunes
, and click OK.
Go to Mail’s Preferences, click the Rules tab, and click the Add Rule button. In the resulting sheet, name the rule Shift iTunes Mail
and configure the If section to read If From Contains iTunes. In the ‘Perform the following actions’ area, create this action: Move Message to mailbox iTunes. Click OK and choose to apply the rule.
If you’re signed up for email alerts from the iTunes Store, you’ll find that your inbox no longer contains those alerts. Instead, they’ve all moved to the iTunes folder you created.

You can use a rule like this to do more than ferret out promotional email. For example, in the From field you might add your company’s domain—If From Contains macworld.com, in my case. I’d then create a new folder for these Macworld messages and have the rule move any messages that meet this condition to that folder. This setup provides me a way to quickly scan through messages from my colleagues.
Filtering groups of senders: There’s a measure of power in Mail’s relationship with the Contacts app. For example, you can ask Mail to filter messages by who is and isn’t in a particular group you’ve created in Contacts.
For instance, suppose you’ve created a group that includes the members of your Keggling Club team. You may wish for mail from any of these members to be marked or moved so that you can find it more easily. Simply create a rule like this:
If Sender is member of Group Keggling Club, Move Message to mailbox Kegglers.

The two-condition rule: I cited this rule when discussing how to end the annoyance from everyone in your company hitting the Reply All button when they should instead click Reply. It requires two conditions.
Here’s the scenario: Some division in your company is clueless about when you should and shouldn’t use Reply All. This leads to your receiving one “Welcome Aboard” message followed by umpteen “Me Too!” replies that you care nothing about. But you’d like to filter these things out without missing any important messages directed to you.
In this case, you first configure the very top pop-up menu that appears in the ‘If x of the following conditions are met’ statement. The x, in this case can be either any or all. If you choose any, only one of the conditions has to be met for the following action to be imposed. With all, every condition must be met for the rule to function.
For this rule to work, you must have all conditions met. You then follow that up with two conditions: From Contains bozorepliers (where bozorepliers is the offending division’s domain name) and To Does not contain me (where me is your email address). Create the first condition and then click the Plus button to its right to create another.

For this rule to execute, not only does the message have to be from the offending domain, but it also can’t be addressed to you personally. (You set it up this way as a fail-safe measure so that messages sent from the domain that demand your specific attention aren’t lost among all the cruft.)
Finally, create a new folder for messages from these people and then design an action that moves any of their mail not addressed to you to this folder.
The multiple-action rule: You can also create rules that have multiple actions.
For example, you could create one that reads: If From Contains theboss (where theboss is your supervisor’s email address), Set Color of Message of Text to Red, Play Sound Sosumi, Send Notification, and Bounce Icon in the Dock. This rule would make your manager’s messages impossible to ignore (see the image at the top of the page). And as with the multiple-condition rule, you add more actions by clicking the Plus button in the actions area.
Rules-like features
Mail includes a couple of features that mimic some of the power of rules. The first is smart mailboxes, and the second is the VIP mailbox.
Smart mailboxes: A smart mailbox is like a rule that has just one action—gathering together matching messages in a specific mailbox. Let’s make one.
Choose Mailbox > New Smart Mailbox (or click the Plus button at the bottom-left corner and choose Smart Mailbox from the menu). Name the mailbox Apple
and configure the condition to read From Contains apple. If you’d like to include messages in Mail’s Trash, enable that option. Click OK, and a new ‘Apple’ mailbox appears beneath the Smart Mailboxes heading in the Mailboxes pane. If you select it, you’ll see all those messages from Apple that advertise one thing or another or inform you that your Apple ID was used to sign in to such and such a service.

How is this different from a similarly configured rule? Smart mailboxes don’t move messages as a rule can. Rather, they present a list of messages that match the mailbox’s conditions. The original messages stay right where they are.
While this arrangement is useful enough on its own, having a list of related messages gathered together in a single mailbox has additional advantages. For example, if you Control-click (right-click) this smart mailbox, you can choose to archive all the messages in it (meaning, make a copy of all these messages and their attachments). Once you’ve made that archive, you can then delete the original messages from the Mail app, secure in the knowledge that you have a backup. (I’ll have more information on backing up and restoring your messages in a future column.)
The VIP mailbox: With Mountain Lion, Apple introduced the VIP mailbox. It’s very much like a smart mailbox, though you configure it differently. The idea behind it is that you can designate certain people you correspond with as very important persons. When you receive a message from such a person, it appears in the VIP mailbox. (Just as with a smart mailbox, the original message remains in the mailbox it was originally delivered to—your inbox, for example.) The purpose of this mailbox is to call out those messages you really want to pay attention to.
You have two ways to bestow VIP status on a contact. The first is to open a message, move the pointer to the sender’s name, and click the star icon that appears to the left of that name. Alternatively, you can place the pointer over any email address at the top of a message (the address will turn blue), click the downward-pointing triangle, and choose Add to VIPs.

So, is this simply a smart mailbox for people who don’t know how to use smart mailboxes? Not entirely. Where VIPs have a leg up on smart mailboxes is in your ability to use VIP status in a rule. If you return to the Rules preference, create a new rule, and then click the first condition pop-up menu, you’ll see that Sender Is VIP is one of the conditions. For example, you could use this condition to create additional alerts—a sound, a bouncing dock icon, or a notification—when you receive a message from a person you consider important enough to merit VIP status.
Rules, smart mailboxes, and the VIP mailbox can be helpful tools for sorting out your email automatically. Take the time to explore each one, and you’ll unclutter your inbox in impressive ways.
Next week: Junk mail and spam