To manage messages using rules follow these steps:
Open Apple Mail by clicking its icon in the dock.
Select Preferences from the Mail menu at the top left of the screen.
Select the Rules tab from the Preferences window that appears.
Click Add Rule to open the new rule window.
In the description field, type a descriptive name for the rule.
Indicate whether any one or all of the rule conditions must be true. Do this by selecting either Any or All
Set the conditions necessary for the rule to apply to a message. Do this by selecting different criteria from the dropdown menus.
For example in the first dropdown you could select From, then in the second dropdown select Contains, finally type in an email address in the entryfield to the right. This will select all messages from the email address you entered.
You can add more then one condition for your rule. Click the Add (+) button to add another criteria. If you change your mind and want to remove a condition then click the Minus (-) button.
Next you need to specify an action for your rule. Use the dropdowns menus to do this.
For example I selected Move Message from the first dropdown and then selected the mailbox I wanted the message moved to from the second dropdown.
Again with actions you can use the Add (+) button to add an action or use the Minus (-) button to remove an action.
Click the Ok button to save your rule.
A popup will appear asking you if you want to apply your rules to messages in selected mailboxes. If you wish to do this then click Apply otherwise click Don't Apply.
Press Command+w on the keyboard to close the Preferences window.
Now all incoming messages will be checked against the rule you just created. If you clicked Apply in Step Eleven your rule will have been applied to your existing messages.