Use rules to manage emails you receive in Mail on Mac
You can create rules that help you manage incoming email messages and automate tasks, such as replying to or deleting messages. For example, you can create a rule that highlights messages from a specific person, or that automatically moves messages from your inbox to other mailboxes.
In the Mail app on your Mac, 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 bottom of the first pop-up menu. To add your own header, click the Add button in the Message Headers window.
Choose actions to perform on messages that meet the conditions. To specify multiple actions, click the Add button .
When you’re done, click OK, then decide to apply rules to existing 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 computer or device synced to your computer.
If you use iCloud Drive, your rules are available on your other Mac computers that have iCloud Drive turned on and Mail selected in in iCloud Drive options. Files attached to rules, such as sound files or scripts, aren’t available. See Use iCloud Drive to store documents.