Back to Tutorials

Aleks Koha10 min read

Email filters are the first real defense against inbox chaos. They sort, label, archive, and forward messages automatically so you're not doing it by hand a hundred times a day. This guide shows you exactly how to create them in both Gmail and Outlook — and then a more powerful 2026 approach for when rigid rules stop keeping up: an AI agent that reads and classifies your inbox every day.


What Email Filters Do (and Where They Fall Short)

A filter (Gmail) or rule (Outlook) is a simple "if this, then that" instruction: if an email matches some criteria — sender, subject, words it contains — then do something to it — label it, move it, archive it, mark it read, forward it.

They're great for clear, stable patterns: newsletters from a known sender, receipts with "invoice" in the subject, anything from your boss. They struggle the moment intent matters more than keywords — which is most real email. We'll get to that. First, the step-by-step for each platform.


How to Create Email Filters in Gmail

Gmail calls them filters, and you can build one in under a minute.

Method 1 — from the search bar:

  1. Open Gmail on the web and click the filter/sliders icon on the right of the search bar (this opens "Show search options").
  2. Enter your criteria — From, To, Subject, Has the words, Doesn't have, size, or date range. For example, From: newsletter@ or Has the words: unsubscribe.
  3. Click Create filter.
  4. Choose what happens to matching mail: Skip the Inbox (Archive it), Mark as read, Apply the label (create one like "Newsletters"), Star it, Forward it, Delete it, Never send to Spam, or Categorize as.
  5. Optionally tick "Also apply filter to matching conversations" to clean up existing mail, then click Create filter.

Method 2 — from an existing email:

Open or select a message, click the ⋮ (More) menu, and choose Filter messages like these. Gmail pre-fills the sender; adjust the criteria and continue as above.

To edit or delete filters later: go to Settings (gear) → See all settings → Filters and Blocked Addresses, where you can edit, delete, export, or import filters.


How to Create Email Filters (Rules) in Outlook

Outlook calls them rules. The steps differ slightly between the new Outlook / Outlook on the web and classic Outlook for Windows.

New Outlook & Outlook on the web:

  1. Click Settings (gear) → Mail → Rules.
  2. Click Add new rule.
  3. Give the rule a name.
  4. Add a condition — e.g. From a specific person, Subject includes certain words, or I'm on the To line.
  5. Add an actionMove to a folder, Mark as read, Categorize, Pin, Forward, or Delete.
  6. Add more conditions/actions or exceptions if needed, then click Save.

Classic Outlook for Windows:

  1. On the Home tab, click Rules → Manage Rules & Alerts.
  2. Click New Rule.
  3. Pick a template (e.g. "Move messages from someone to a folder") or start from a blank rule.
  4. Set the conditions, click Next, choose the actions, set any exceptions, and click Next.
  5. Name the rule, optionally tick "Run this rule now on messages already in the inbox," and click Finish.

Shortcut: right-click any message and choose Rules → Create rule to pre-fill conditions from that email.


The Limits of Rule-Based Filters

Both Gmail filters and Outlook rules share the same ceiling: they match patterns, they don't understand meaning.

That's fine until reality intervenes. A genuinely urgent email from a brand-new sender has no rule to catch it. "Filter newsletters" works until a sales email isn't technically a newsletter. You end up writing rule after rule, each covering one more special case, until you have forty brittle filters that still miss things and occasionally bury something important. Rules can't tell an angry customer from a routine reply, or a real invoice from a payment-reminder spam — because those distinctions live in the content and intent, not in a keyword.

This is exactly the gap an AI agent closes: instead of matching keywords, it reads each email and classifies it the way you would.


A Smarter Way: An AI Email Classification Agent

Instead of dozens of rigid rules, you can set up one agent that reads your inbox on a schedule and sorts it by what each email actually means — urgent, needs a reply, FYI, promotional, receipt, and so on — applying labels (Gmail) or categories/folders (Outlook) automatically and sending you a short daily digest.

With Matagi, you don't write code or build a workflow. You connect your inbox, then describe the agent in plain English and Matagi provisions it, schedules it as a daily run, and even gives it a small control panel where you can review and tweak the rules. Here's the full flow — it takes about ten minutes.

Step 1: Get Claude

You'll drive the setup from an MCP-capable client. The simplest is Claude (the desktop app or Claude Code). MCP — the Model Context Protocol — is what lets Claude talk to Matagi and build the agent for you. If you already use another MCP client, that works too.

Step 2: Add the Matagi MCP

In Claude, open Settings → Connectors → Add custom connector and add the Matagi MCP (you'll find the MCP URL in your Matagi account). Once it's connected, Claude can create and deploy agents in your Matagi workspace directly from chat.

Note: this is the standard Matagi MCP, not the developer/runtime one — it's the one that manages your integrations and agents.

Step 3: Connect Your Email

Go to app.matagi.ai/integrations and connect the inbox you want classified. Matagi supports both Gmail and Microsoft Outlook, so connect whichever you use (you can connect more than one). This authorizes Matagi to read and label your mail through an encrypted proxy — your credentials never end up in any generated code, and you can revoke access at any time.

Step 4: Add a CONTROL_PANEL_ACCESS_PSW Credential

The classification agent deploys with a small control panel — a web page where you can see what it classified and adjust its categories. To keep that panel private, protect it with a password.

On the same app.matagi.ai/integrations page, open the Custom Credentials section and add a new credential:

  • Key: CONTROL_PANEL_ACCESS_PSW
  • Value: a strong password of your choice

The agent will require this password before anyone can open its control panel, so your inbox classifier isn't sitting behind an open URL.

Step 5: Paste This Prompt to Build the Agent

With the MCP connected, your inbox linked, and the credential set, paste this into Claude and edit the bracketed parts:

Using the Matagi MCP, build and deploy a daily email classification agent for my
connected [Gmail / Outlook] inbox (account: [you@example.com]).

Each morning at 08:00 [Europe/Tallinn], read every email received in the last 24
hours and classify each into exactly one of these categories:
  - Urgent — needs my attention today
  - To Respond — expects a reply but not urgent
  - FYI / Newsletter — informational, no action
  - Sales / Promo — cold outreach or marketing
  - Receipts & Invoices — billing and payments
  - Other

For each email, apply the matching label (Gmail) or category/folder (Outlook).
In Gmail, also archive anything classified as "FYI / Newsletter" or "Sales / Promo"
so my inbox only shows what matters. Never delete anything.

Then email me (or post to Slack) a short daily digest: how many landed in each
category and the subject lines of anything marked Urgent.

Deploy this as a scheduled daily agent (a cron), and give it a control panel where
I can review classifications and adjust the categories. Protect the control panel
using my CONTROL_PANEL_ACCESS_PSW credential.

Claude will use the Matagi MCP to create the agent, wire it to your inbox, schedule the daily run, and deploy the password-protected control panel. Run it once manually to check the first batch, adjust any categories that feel off, then let it run every morning.

That's the whole point: instead of maintaining forty filters that only match keywords, you have one agent that reads your mail like you would — and you can change how it thinks just by editing a sentence.

Start free at matagi.ai.


Gmail Filters vs Outlook Rules vs an AI Agent

Gmail FiltersOutlook RulesAI Classification Agent
Matches onKeywords, sender, fieldsKeywords, sender, fieldsMeaning & intent
SetupPer-rule, manualPer-rule, manualOne plain-English brief
Handles new/unseen mailNoNoYes
Daily digestNoNoYes
Best forStable, obvious patternsStable, obvious patternsMessy, real-world inboxes
CostFreeFreeUsage at exact cost (free trial)

Native filters and an AI agent aren't mutually exclusive — keep a few solid filters for the obvious stuff, and let the agent handle the judgment calls.



FAQs

How do I create an email filter in Gmail? Click the filter/sliders icon in Gmail's search bar, enter your criteria (from, subject, or words the email contains), click "Create filter," then choose actions like applying a label, archiving, or marking as read. You can also start from an email via the ⋮ menu → "Filter messages like these." Edit existing filters under Settings → Filters and Blocked Addresses.

How do I create email filters in Outlook? Outlook calls them rules. In new Outlook or Outlook on the web, go to Settings → Mail → Rules → Add new rule, set a condition and an action, and save. In classic Outlook for Windows, use Home → Rules → Manage Rules & Alerts → New Rule. You can also right-click a message and choose Rules → Create rule.

What's the difference between a Gmail filter and an Outlook rule? They're the same concept under different names — automatic "if this, then that" handling of incoming mail. The mechanics and available actions differ slightly between the platforms, but both match on senders, subjects, and keywords rather than understanding what an email actually means.

Can AI create email filters automatically? Yes — and it goes further than static filters. An AI classification agent reads each email and sorts it by intent (urgent, needs a reply, promotional, receipt, etc.), then labels or archives it accordingly. With Matagi you set this up by connecting your inbox and describing the agent in plain English; it runs daily without you maintaining rules.

Is it safe to give an AI agent access to my inbox? With a platform like Matagi, your email is connected through an encrypted proxy, so credentials never appear in any code, every action the agent takes is logged, and you can revoke access at any time. You can also restrict the agent to labeling and archiving only — never deleting — and protect its control panel with a password (the CONTROL_PANEL_ACCESS_PSW credential).

Do email filters apply to messages already in my inbox? They can. In Gmail, tick "Also apply filter to matching conversations" when creating the filter. In classic Outlook, tick "Run this rule now on messages already in the inbox." An AI agent can likewise do an initial pass over recent mail and then run on a daily schedule.

emailtutorialGmailOutlookAI agentsproductivity

Build your first AI agent free

Describe what you want done in plain English. Matagi provisions the infrastructure, wires the integrations, and deploys it.

Get started