Automate Email

Probably 90 percent of the time I spend using my Mac involves one of three apps: a word processor (I am an author, after all), a Web browser, and an email client. I send and receive large quantities of email, and I use email far more frequently than phone calls or instant messaging—maybe even more than speaking. It’s my main means of communication.

Because my incoming and outgoing email volume is so high, I can’t bear to spend any more time or effort than is absolutely necessary on filing or searching for messages. So I’ve thought long and hard about how to automate as much of that process as possible—while still ensuring that important messages never slip through the cracks.

One of my key strategies is to use rules (sometimes referred to as filters) to process messages as they come in. Each rule looks for certain conditions (criteria such as a sender, subject, or words in the message body), and then takes one or more actions whenever a match is found. For example, the rule might move the message into a certain mailbox, send an automatic reply, or delete the message.

If you’re trying to keep your Inbox under control, rules are one of the most powerful tools available. Because I presort my email with rules, tons of messages that don’t require immediate attention never reach my Inbox at all; instead, they’re safely shunted to other mailboxes where I can review them at my convenience. Creating a good set of rules requires a bit of thought and effort, but once you’ve done that, those rules operate invisibly in the background.

Rules are a very powerful organizational aid, but making them is just one aspect of automating email. You may also want to simplify the manual filing of messages that aren’t picked up by rules, add plug-ins that automate various other email actions, or use smart mailboxes as search shortcuts. I cover all those activities in this chapter.

Use Server-based Rules

Rules can operate either in your email client (such as Apple Mail) or directly on your incoming mail server. The huge advantage to server-based rules is that they can presort messages before you see them, even if your Mac email client isn’t running. That greatly reduces the amount of mail you need to deal with on your iPhone or iPad.

I recommend starting with server-based rules if possible and then using rules in your email client for the actions you can’t accomplish on the server, like running user-defined AppleScripts on matching messages or moving messages to mailboxes in other accounts.

Check with your email provider to see whether it offers server-side rules or filters, and if so, what the procedure is to configure them. Here’s how to get started with iCloud and Gmail:

Although the details vary from one provider to the next, rules always contain one or more conditions (things to search for) and then, when there’s a match, perform one or more actions. For example, look for any message from a certain address (say, a company’s PR department) and file it in a Newsletters mailbox.

If your email provider doesn’t offer server-based rules, or if its conditions or actions don’t meet your needs, you can move on to rules in your email client. If Mail is your preferred client, that’s just one of the ways you can automate your email.

Tip: A service called SaneBox will, for a monthly fee, perform an automated analysis of your incoming messages, determine what’s likely to be less important to you, and move it out of your Inbox (providing only a brief summary). It can do other tricks too, such as providing server-based rules—even if your email provider doesn’t offer them—and automatically moving attachments to cloud storage such as Dropbox. Although SaneBox doesn’t fit my model of email management, many people find it immensely helpful.

Automate Apple Mail

Apple Mail is my email client of choice, and as I mentioned, I go to great lengths to automate my email. In this chapter, I’ll cover my three main techniques: using rules to pre-sort my messages, using plug-ins to file and otherwise work with them once they’re in my Inbox, and using smart mailboxes for searching. This information largely comes from my book Take Control of Apple Mail, which contains far more detail—not just about automation but also about using email more effectively, troubleshooting problems, and becoming a better correspondent.

Manage Incoming Apple Mail with Rules

Whether or not you use server-based rules, you might want to set up rules within Mail. They work essentially the same way—sorting, deleting, replying to, or otherwise processing incoming messages. But they can do a few things server-based rules can’t do (such as moving a message to a different account and running an AppleScript). And, if you can’t use server-based rules, Mail’s rules are the best way to manage the flow of incoming messages.

Tip: For help writing an AppleScript that will be used in a Mail rule, open AppleScript Editor (in /Applications/Utilities) and choose File > New from Template > Mail > Mail Rule Action. That’ll open a template with example code to get you started.

Create a Rule

To create a basic rule, follow these steps:

  1. Go to Mail > Preferences > Rules and click Add Rule.

    A dialog appears showing the condition(s) the rule checks for and the action(s) Mail takes if the conditions match (Figure 24).

    **Figure 24:** Use this dialog to specify the condition(s) and action(s) for your Mail rule.

    Figure 24: Use this dialog to specify the condition(s) and action(s) for your Mail rule.

  2. Enter a name for the rule in the Description field.
  3. Create a condition. Start by choosing something from the left-hand pop-up menu in this area. Depending on what you choose, you may now see a second pop-up menu, a text field, or both. Here are some examples of a completed condition:
     [From] [Contains] apple.com
     [Subject] [Begins with] Take Control
     [Date Sent] [Is Less Than] 3 days old
     [Message Content] [Does not contain] Mavericks
    
  4. From the provided pop-up menus, choose the action you want the rule to perform on a message if (and only if) it matches the condition you just specified. (Just ahead I explain how to handle rules that include multiple actions.) Here are some examples:
     [Move Message] to mailbox: [Filed]
     [Set Color of Message] [of background] [Blue]
     [Reply to Message]
     [Mark as Read]
    

    If you use a rule to move a message, choose your target mailbox carefully. In general, unless you mean to specifically archive the message to a local mailbox, you’ll want to move it to a server-based mailbox—most likely in the same account—so the message will be available on all your iOS devices and other Macs.

  5. Click OK.

    An alert appears, asking if you want to apply your rules (including the one you just created) to messages in selected mailboxes.

  6. Click Apply or Don’t Apply, as you prefer. I generally suggest clicking Don’t Apply, because applying new rules to messages in open mailboxes can have unexpected and potentially unpleasant results.
  7. If you’re finished creating rules, close the Preferences window.

Your new rule now checks all incoming messages for matches and performs the actions on them that you set.

Rule Examples

One of the most common uses for rules is to process repetitive messages. If you find yourself filing, flagging, or deleting a certain type of message at least once a week, you can save time and effort by setting up a rule to do it for you. Examples are mailing lists, utility bills, bank statements, newsletters, travel discount offers, and jokes forwarded by friends or family members.

Here are a few rules I use:

TidBITS issues:

If Any of the following conditions are met:

[From] [Contains] editors@tidbits.com

Perform the following actions:

[Move Message] to mailbox: [Lists]

Any public Apple mailing list:

If Any of the following conditions are met:

[From] [Contains] @lists.apple.com

[Cc] [Contains] @lists.apple.com

Perform the following actions:

[Move Message] to mailbox: [Lists]

Feedback about this book:

If Any of the following conditions are met:

[Subject] [Is] Take Control of Automating Your Mac

Perform the following actions:

[Move Message] to mailbox: [Take Control Feedback]

Tip: To ensure that a message matched by a given rule isn’t also processed by other rules, add the Stop Evaluating Rules action as the final action for any rule. Doing this improves Mail’s performance and avoids potential rule conflicts.

Mavericks’ Mail applies rules automatically to messages as they are delivered to your Inbox. Sounds about right, but there is a hitch. Mail does not apply rules to messages that arrive in other mailboxes, even if the messages are unread. That means if you have a server-based rule that moves certain messages to your Family mailbox, those messages bypass your Inbox and therefore don’t get processed by Mail’s rules.

You can manually apply rules to selected messages, wherever they reside, by choosing Message > Apply Rules. For example, you might want Mail to use rules to re-sort messages that were moved into the wrong mailbox by the server. However, note that that command applies all your rules, not just a specific rule. If you want more control over after-the-fact rules, try the Mail Act-On plug-in.

Automate Apple Mail with Plug-ins

Dozens of third-party Mail plug-ins let you give the program new features, enable significant new customization options, and even zap unwanted features. For example, plug-ins can stop spam, encrypt email messages, offer advanced message filing options, change the way attachments are handled, modify Mail’s method of quoting text in replies, and much more.

I won’t try to catalog all the available Mail plug-ins here, but allow me to refer you to a Macworld article I wrote about My nine must-have plug-ins for Apple Mail, and lists that other people have compiled and maintain: Maximizing Mail: Add-ons for Mac OS X’s Mail app at Macworld, and Apple Mail Plugins and Tools.

However, I do want to put in a plug (so to speak) for a few plug-ins that I find especially helpful for automating Mail above and beyond what rules do. These plugins allow me to act on messages in my Inbox and save time when composing or replying:

Note: Although Mail Act-On is my personal pick for filing messages from the keyboard, other plug-ins that do similar things and have their own loyal fans include MsgFiler and MailHub.

Tip: Mail lets you define signatures that appear at the bottom of each message (see Mail > Preferences > Signatures). Although Mail provides a decent level of customization, it doesn’t approach what you can get if you Use a Third-party Text Expansion Utility instead.

Search Faster with Smart Mailboxes

Back in Create and Use Smart Containers, I explained what smart mailboxes are (basically, saved searches) and how to create them. If you click a smart mailbox icon, it should initially display exactly the same messages as the search you used to create it. As you receive and delete messages that meet your criteria, the list will change.

Here are my favorite suggestions for making smart mailboxes:

Automate Outlook Email with Rules

Whatever you may think of Microsoft in general or Office in particular, Microsoft Outlook for Mac is a highly capable email client with extensive automation capabilities. You can create rules much like those in Apple Mail, but with a few key differences:

To create a rule in Outlook:

  1. Choose Tools > Rules.
  2. Select an account type in the list on the left.
  3. Click the plus button.
  4. Enter the desired condition(s) and action(s), give the rule a name, and click OK.

The rule begins working immediately.

Automate Other Email Apps

I’ve focused here on Mail and Outlook because of their popularity. But lots of other Mac email clients contain rules and/or other automation features, too, including:

I refer you to the apps’ documentation to discover how to use their respective automation features.