It's easy to create Apple Mail rules that tell the application how to process incoming pieces of mail.
Rules have two components: the condition and the action. Conditions are guidelines for selecting the type of message an action will affect. You could have a Mail rule whose condition looks for any mail from your friend Sean, and whose action is to highlight the message, so you can more easily see it in your inbox.
Mail rules can do much more than simply find and highlight messages. They can organize your mail; for example, they can recognize banking-related messages and move them to your bank email folder. They can grab spam from recurring senders and move it automatically to a Junk folder or the Trash. They can also take a message and forward it to a different email address. There are currently 12 built-in actions available. If you know how to create AppleScripts, Mail can also run AppleScripts to perform additional actions, such as launch specific applications.
In addition to creating simple rules, you can create compound rules that look for multiple conditions before performing one or more actions. Mail's support for compound rules allows you to create very sophisticated rules.
In this Quick Tip, we'll create a compound rule that will recognize mail from your credit card company and notify you that your monthly statement is ready by highlighting the message in your inbox.
The message we're interested in is sent from the alert service at Example Bank, and has a 'From' address that ends in alert.examplebank.com. Because I receive various types of alerts from Example Bank, I'll need to create a rule that filters messages based on the 'From' field as well as the 'Subject' field. Using these two fields, I can differentiate all of the types of alerts I receive.
Launch Apple Mail
- Launch Mail by clicking the Mail icon in the Dock, or by double-clicking the Mail application located at: /Applications/Mail/.
- If you have a statement alert from your credit card company, select it so the message is open in Mail. If a message is selected when you add a new rule, Mail assumes that the message's 'From,' 'To,' and 'Subject' fields will probably be used in the rule, and automatically fills the information in for you. Having the message open also lets you see any specific text you may need for the rule.
Add a Rule
- Select 'Preferences' from the Mail menu.
- Click the 'Rules' button in the Preferences window that opens.
- Click the ‘Add Rule’ button.
- Fill in the 'Description' field. For this example, I will use ‘Example Bank CC Statement’ as the description.
Add the First Condition
- Use the dropdown menu to set the ‘If’ statement to ‘All.' The 'If' statement allows you to choose between two forms, 'If any' and 'If all.' The 'If' statement is helpful when you have multiple conditions to test for, as in this example, where we want to test both the 'From' and 'Subject' fields. If you will only be testing for one condition, such as the 'From' field, the 'If' statement doesn't matter, so you can leave it in its default state.
- In the 'Conditions' section, just below the 'If' statement, select 'From' from the left-hand dropdown menu.
- In the 'Conditions' section, just below the 'If' statement, select 'Contains' from the right-hand dropdown menu.
- If you had a message from the credit card company open when you started creating this rule, the 'Contains' field will be automatically filled in with the appropriate 'From' email address. Otherwise, you will need to enter this information manually. For this example, we will enter alert.examplebank.com in the 'Contains' field.
Add the Second Condition
- Click the plus (+) button to the far right of the existing condition.
- A second condition will be created.
- In the second conditions section, select 'Subject' from the left-hand dropdown menu.
- In the second conditions section, select 'Contains' from the right-hand dropdown menu.
- If you had a message from the credit card company open when you started creating this rule, the 'Contains' field will be automatically filled in with the appropriate 'Subject' line. Otherwise, you will need to enter this information manually. For this example, we will enter Example Bank Statement in the 'Contains' field.
Add the Action to be Performed
- In the 'Actions' section, select 'Set Color' from the left-hand dropdown menu.
- In the 'Actions' section, select 'Text' from the middle dropdown menu.
- In the 'Actions' section, select 'Red' from the right-hand dropdown menu.
- Click the ‘OK’ button to save your new rule.
Your new rule will be used for all subsequent messages you receive. If you would like the new rule to process the current contents of your inbox, select all of the messages in your inbox, then select 'Messages, Apply Rules' from the Mail menu.
Apple Mail rules are very versatile. You can create complex rules with multiple conditions and multiple actions. You can also create multiple rules that work together to process messages. Once you try Mail rules, you'll wonder how you ever managed without them.