Apple’s Mail app — the Mac one, not the iOS one — has a secret weapon for automatically cleaning up your inbox. It’s called Rules, and you can use it to process all arriving emails, so you don’t have to.
Mail rules can be used to get custom alerts, to automatically file invoices, to save newsletters out of the inbox, to block senders, and lots more. Today we’re going to check out a few of the most interesting Mac Mail rules so you can get started cleaning up your inbox.
Local rules vs. server-side rules
You’ll find the rules section in the Mac Mail app’s preferences. There’s one default rule, called News from Apple, which is worth looking at before you delete it, just to see how these things work:

Photo: Cult of Mac
Mail’s rules run on your Mac, which means that — obviously — your Mac needs to be running in order to process incoming email. If you hate the environment, and leave your Mac running all day, then these rules will be executed right away, meaning that any changes they make will be reflected in the Mail apps on your iPhone and iPad.
All rules work like this: You set a condition which must be met — a from or to email address, whether the mail has an attachment, and so one. Then you set an action — delete, move to a folder, send a notification, etc. You can combine multiple conditions and actions to come up with some powerful processing.
If you don’t leave your computer on all day, even while you’re not in the house, then you are a) a better person and b) a person who requires a different setup. Many email services, like Gmail and Fastmail, offer their own powerful rules engines that can process your email on the server, before you even see it. Check out your mail provider to see what’s possible.
And now, some cool example mail rules for your Mac.
Block sender

Photo: Cult of Mac
This rule lets you block all emails from a particular sender. This could be an ex-partner, your boss or anything. Just set the conditions to match one or more email addresses (click the little + button to add more), then set the action to Delete Message.
File all your App Store invoices

Photo: Cult of Mac
You may want to keep all of your App Store invoices, but you probably don’t want to have them all in your inbox. Use this rule to move them to a folder (and send you an alert when they arrive).
Collect all newsletters
This rule works like the one above, but we use a neat trick to grab the sender’s address:

Photo: Cult of Mac
The trick is that, when you create a new rule, and click to select the From address as a condition, the address of the currently selected email is auto-added to the box. That is, if you’re already viewing an email message when you create a rule, the Mail app will automatically grab info from that message.
Flag important mail

Photo: Cult of Mac
You could use Mail’s VIP function for this, but to manually flag all mails from a particular sender, use this rule.
Filter unknown senders
This rule redirects any mail from unknown senders to a folder.

Photo: Cult of Mac
As you can see, rules can be pretty powerful. Take a look around when you’re in the Rules section of Mail’s preferences to see exactly what’s possible. And don’t forget to combine multiple conditions and actions for extra flexibility.