Mail (Yosemite): Use rules to manage your inbox
Choose Mail > Preferences, then click Rules.
To review an example of a rule, select a provided rule, then click Edit. To close the rule, click Cancel.
Click Add Rule, then type a name for the rule.
Indicate whether any or all of the conditions must be true for the rule to be applied to a message.
Specify the conditions.
To use different header fields in conditions, choose Edit Header List from the first pop-up menu. To add your own header, click Add in the Message Headers window.
Choose actions to perform on messages that meet the conditions. To specify multiple actions, click Add .
When you’re done, click OK, then decide to apply rules to messages already in mailboxes or to new messages.
You can apply rules to existing messages later by choosing Message > Apply Rules.
If you have multiple rules, they’re applied in the order in which they appear in the list of rules; drag a rule up or down to change the order.
Mail stops applying rules to a message when it encounters the Stop Evaluating Rules action, or when a message is transferred to another mailbox by rules used on a mail server or on a computer or device synced to your computer.
When you disable an email account, rules applied to the account’s mailboxes are also disabled; you must enable the rules again after you reenable the account.
If you use iCloud Drive, your rules are available on your other Mac computers that have iCloud Drive turned on. Files attached to rules, such as sound files or scripts, aren’t available. For more information, see Store documents with iCloud Drive.