$cd ../use-cases/
⚡ ProductivityMost Popular20 min setup
$ cat email-ai-assistant.md
await manageInbox(gmail, { autoTriage: true })
/** I let OpenClaw manage my inbox for 30 days. Here's exactly what happened. */
📊 30-Day Experiment Results
94%
emails correctly categorized
2.1 hrs
saved per week
0
important emails missed
$0
running on local Ollama
how_it_works.md
⚙️ How It Works
1.
OpenClaw polls Gmail every 5 minutes
Using the Gmail API with read-only scope, OpenClaw checks your inbox continuously. Your credentials are stored locally on your server and never leave it. Emails are processed in-memory — no copies are stored unless you explicitly enable archiving. The polling interval is configurable from 1 to 60 minutes.
2.
LLM classifies each email
Each email is classified into one of four categories: Urgent (requires action today), Needs Reply (expected response, not time-critical), Newsletter/Digest (informational, archive-worthy), or Auto-Archive (promotional, spam, automated notifications). The LLM also scores sender importance based on your historical reply frequency — your boss's emails always get flagged.
3.
You get a Telegram digest
Twice a day (configurable), OpenClaw sends a formatted digest to your Telegram: urgent items at the top, a count of reply-needed messages, newsletters summarized in one line each. You don't open your email app — you read the digest and decide what needs your attention. Truly urgent emails (like an outage alert or a legal notice) trigger an immediate ping.
4.
Reply via chat, OpenClaw sends the draft
Forward the Telegram message about an email you need to reply to, add your notes (e.g., 'decline politely, suggest next quarter'), and OpenClaw drafts a professional response. You review it, make any edits, and confirm — OpenClaw sends it via Gmail API. The entire loop takes 60-90 seconds instead of the typical 5-10 minutes of context-switching and composing.
setup.yaml
📦 Setup (20 minutes)
// Step 1: Enable Gmail API in Google Cloud Console → Download credentials.json
$ cp ~/Downloads/credentials.json ~/.openclaw/gmail/
// Step 2: Add Gmail skill to config
skills:
gmail:
enabled: true
poll_interval: 300
notify_channel: "telegram"
// Step 3: Authorize and test
$ openclaw skill gmail auth
$ openclaw skill gmail test
# ✓ Connected. 47 unread emails found.
example_digest.log
📬 Example Morning Digest
🦞 OpenClaw — Morning Email Digest (08:00)
🔴 Urgent (2)
• Invoice #1042 overdue — from Acme Corp
• Server alert from DigitalOcean — disk at 94%
💬 Needs Reply (4)
• Interview request from Recruiter at Stripe
• Meeting reschedule — John (tomorrow 2pm → 4pm?)
📰 Newsletters archived: 12 | Automated: 8
❓ FAQ
Q1. Does OpenClaw read all my emails?
Only with read-only Gmail API scope — it cannot send, delete, or modify emails unless you explicitly grant send permission for the reply feature. It classifies and summarizes email content, but attachments are never processed unless you explicitly add an attachment-processing skill. You can further restrict it with Gmail filter rules (e.g., skip emails from certain senders).
Q2. Can it compose replies for me?
Yes. Reply to the Telegram digest message with context — as brief as 'decline, suggest next quarter' or as detailed as you like. OpenClaw drafts a full professional response in your voice, sends it to Telegram for approval, and submits via Gmail API only after you confirm. You can request rewrites as many times as needed before approving.
Q3. What about work emails with sensitive data?
Everything runs on your hardware. With local LLMs via Ollama, email content never leaves your server at any point — the processing pipeline is entirely offline. Even with cloud API models, only the email text is sent for classification and summarization, never attachments. For maximum privacy, you can configure certain sender domains to be summarized locally regardless of model settings.
Q4. Does it support Outlook/Yahoo?
Native Gmail API integration is the current production implementation. Outlook/Microsoft 365 support via Microsoft Graph API is on the near-term roadmap. For Yahoo, Apple Mail, and other providers, OpenClaw supports generic IMAP polling — functionality is equivalent but without Gmail's push notification capabilities, so polling interval is the only latency mechanism.
Q5. How accurate is email classification?
Classification quality depends on your inbox and your categories, so any single accuracy figure would be misleading. Expect to spend the first week correcting it — that correction loop is what makes it useful. Measure it on your own mail before relying on it. Tested with a mixed inbox (personal, business, automated). The LLM understands context rather than just keywords — it knows that 'server alert from DigitalOcean' is urgent, 'weekly newsletter from Medium' is archive-worthy, and 'can we sync this week?' from your CEO requires a reply. Accuracy increases with your approval history as the model learns your specific priorities.
Q6. Can it handle mailing lists and newsletters differently?
Yes. Newsletters and digest emails are identified, archived from your main inbox, and summarized in one line each in your daily digest. You can configure specific senders to always be summarized (never shown in detail), always flagged as urgent, or completely ignored. The newsletter summary is a separate digest section, not mixed with actionable email.
Q7. What if I get an email while I'm busy and miss the digest?
Truly urgent emails — defined by your configured urgency rules — trigger an immediate Telegram ping regardless of digest timing. For other emails, the digest is sent twice daily (default: 7 AM and 6 PM, configurable) and covers everything since the last digest. You can also query your inbox anytime: 'Hey OpenClaw, do I have anything from [contact] today?' and get a real-time answer.