← Back to blog

Triage your Gmail inbox with Claude Code

guidesgmailclaude-code

If you spend the day in Claude Code, your inbox can live there too. Ask it which emails need a reply, have it draft the easy ones, and let it archive the newsletters you were never going to read. This guide sets that up for Gmail and Google Workspace in about ten minutes.

It uses Fluxmail, a self-hosted MCP server that connects Claude Code to your mailbox. Fluxmail runs on your computer and talks to Gmail directly, and you choose what Claude Code is allowed to do.

1. Connect Gmail

Install the Fluxmail CLI, create the local administrator, and connect your Gmail account:

npm install -g fluxmail
fluxmail setup --name "Your name" --email you@example.com
fluxmail accounts add gmail

accounts add gmail opens Google's sign-in page in your browser. Approve access, and Fluxmail stores the OAuth tokens encrypted on your machine. If you would rather use your own Google Cloud app, see Connect Gmail.

2. Add Fluxmail to Claude Code

Triage needs to read mail, archive it, and write drafts. It does not need to send anything. The read-write profile allows exactly that:

claude mcp add fluxmail -- fluxmail stdio --profile read-write

With this profile Claude Code can draft replies, but every message still goes out through you. Run claude mcp list to check that the server is connected.

3. Run your first triage

Start Claude Code and ask:

Look at my unread inbox from the last three days. Sort each message into Reply needed, Read later, or Noise. Show me the list before you change anything.

Claude Code searches your inbox with Fluxmail's search_emails tool, using a query like this:

in:inbox is:unread after:2026-09-20

It opens threads with get_thread when a subject line is not enough to decide, and returns a list grouped into the three buckets. Nothing in your mailbox has changed yet.

Read the list and correct anything it got wrong. "The message from Priya is a reply, not noise" is enough. Then ask it to act:

Archive everything in Noise. Draft short replies for Reply needed, but leave anything about pricing for me.

Claude Code archives with modify_emails and writes each reply with create_draft. The drafts sit in your Gmail Drafts folder, threaded under the original messages, so you can edit and send them from Gmail or your phone.

4. Write down your rules

The first run is mostly Claude Code learning what you care about. Save those decisions so you do not repeat them. A Claude Code skill is a Markdown file with instructions that you can run by name. Create ~/.claude/skills/triage-inbox/SKILL.md:

---
name: triage-inbox
description: Sort unread Gmail into Reply needed, Read later, and Noise, then archive noise and draft replies.
---

Search my inbox for unread mail from the last three days.

Sort each message into:
- Reply needed: a person is waiting on me. Customers, my team, anyone I have written to before.
- Read later: long updates and reports that do not need an answer.
- Noise: newsletters, notifications, and marketing I did not ask about.

Rules:
- Messages from @mycompany.com are never Noise.
- Receipts and invoices go to Read later. Do not archive them.
- Show me the sorted list and wait for my OK before archiving or drafting.
- After I approve, archive Noise and mark Read later as read.
- Draft replies of three sentences or fewer. Never promise a date or a price.
- Do not draft replies to anything about pricing, contracts, or legal terms.

Now each triage starts with /triage-inbox. Edit the file whenever Claude Code makes the same mistake twice.

5. Use labels if you have them

If you already sort mail with Gmail labels, tell Claude Code which ones to use. It can list your labels with list_labels and apply them with modify_emails:

Label anything from the Acme account team with Customers/Acme, then archive it.

If a label does not exist yet, Fluxmail creates it in Gmail. Check the names in the plan first so a typo does not become a new label.

Tips for a large backlog

  • Work in batches. Ask for 25 messages at a time. Long lists make it harder to review the plan before Claude Code acts.
  • Search precisely. Fluxmail's search syntax supports from:, subject:, has:attachment, before:, and after:. "Archive everything from from:noreply@github.com older than a month" clears a lot of mail in one step.
  • Check before trusting a zero. Ask Claude Code to confirm the search covered the whole date range. Large searches can return partial pages, and Fluxmail reports when more results are left.

Keep Claude Code on a short leash

An email in your inbox can contain instructions aimed at the agent reading it. Keep the read-write profile so a message cannot make Claude Code send mail, and keep the approval step in your skill so you see the plan before anything moves. How to give an AI agent access to your email safely covers the rest.

Next steps

  • Use Outlook too? The same setup works there: Triage your Outlook inbox with Claude Code.
  • Make the drafts sound like you: Draft email replies in your voice with Claude Code.
  • Have Claude Code summarize your inbox every morning: Get a daily inbox summary on a schedule.

The Claude Code integration guide covers HTTP connections and more setup options.