Home
Guides

OpenClaw Email Skill: Setup, Safe Permissions and a Real Inbox

Engineer configuring email access for an AI agent

An OpenClaw email skill lets your self-hosted assistant read, search, draft and send mail. The fastest way to get one running is to point a skill at an existing Gmail or IMAP account. The most dependable way to run it for months is to give the agent a mailbox of its own, with its own address, its own credentials and its own log. That is what we build at Qubrics: a real mailbox per agent, reached through one API, so your agent never borrows a human's login.

This guide covers both routes. You will see what the built-in skills do, how to install them, which safeguards the OpenClaw docs recommend, and where a dedicated mailbox fits. It also answers the question behind the related search "openai agents email": how adding email to an OpenAI Agents SDK agent differs from an OpenClaw skill.

Engineer configuring email access for an AI agent

TL;DR

  • OpenClaw ships email skills for IMAP/SMTP (Himalaya) and Gmail (gog), plus an IMAP trigger plugin that starts an isolated agent run per incoming message.
  • A shared Gmail login with an app password gives the agent access to the whole account, whatever rules you write in the prompt.
  • Start read-only, draft before you send, and run untrusted inbound mail through a restricted reader agent.
  • A dedicated agent mailbox keeps the agent's mail, credentials and logs separate from yours.
  • The same mailbox can serve an OpenClaw skill, an OpenAI Agents SDK tool or an MCP client.

Table of Contents

What an OpenClaw email skill actually does

A skill is a packaged set of instructions and commands the agent can call. OpenClaw's email options split into two jobs.

Acting on mail. The Himalaya skill uses a command-line client for IMAP and SMTP (the standard protocols for reading and sending mail) to list, read, search, compose, reply, forward, copy, move and delete messages, with attachment support. The gog skill does similar work for Gmail: search, send, drafts, and replies through a reply-to-message ID.

Reacting to mail. The IMAP trigger plugin watches a mailbox and starts a separate, isolated agent session for each allowed incoming message. It does not send email, change message flags, expose a public webhook, or backfill messages that were already there when monitoring began.

So a complete email agent usually needs both: a trigger to wake it up and a skill to answer. That pairing is exactly where most home-built setups get fragile.

What an OpenClaw email skill actually does

Setting up Himalaya and gog

Himalaya for IMAP and SMTP

Install the Himalaya CLI (for example with brew install himalaya), then run himalaya account configure and enter your IMAP and SMTP details. The configuration is stored at ~/.config/himalaya/config.toml. The skill itself tells you to keep credentials in a password manager or keyring and never paste secrets into chat or logs, per the skill file.

For Gmail over IMAP, Everpod's guide gives the connection details: imap.gmail.com on port 993 with TLS for incoming, smtp.gmail.com on port 587 with STARTTLS for outgoing. It also notes that a Google app password needs 2-Step Verification switched on, and that the app password is not limited to one sender, label or attachment type. A prompt rule such as "only read invoices" does not narrow what the credential can reach.

gog for Gmail OAuth

The gog skill's one-time setup runs gog auth credentials /path/to/client_secret.json, then gog auth add you@gmail.com --services gmail,.... The skill warns against ever asking for passwords, client secrets or refresh tokens in chat (gog skill).

OAuth lets you grant narrower scopes than a password does. The openclawvps.io guide suggests starting with the read-only scope, moving to the modify scope once triage logic is trusted, and using the send scope only for autonomous sending. It also notes that an unverified Google app caps refresh tokens at seven days for sensitive scopes, which is why OAuth tokens that quietly expire are such a common production complaint.

Your own account or a mailbox of its own?

Connecting your primary inbox is the quickest start, and the OpenClaw Field Playbook suggests a cautious scope for it: a rolling 48-hour window of received mail, sent mail for context, drafts only, and no sending, deletion or label management at first.

The weakness is structural. The agent shares your identity, your history and your credential. If the token expires, the agent goes dark. If a provider flags automated activity, your own mailbox is the one affected. And everything the agent sees is everything you receive.

A forwarding pattern reduces this. CoClaw's setup guide recommends a dedicated mailbox that only receives forwarded or filtered mail such as alerts, receipts or a support queue, with separate read and send identities. That shrinks the prompt-injection surface and makes it easier to audit what the agent saw.

A dedicated agent mailbox takes that pattern to its conclusion. With Qubrics, each agent can have a real mailbox and address on the shared @myagent.mx domain or a custom domain verified for sending and receiving. The Mailbox API sends from that address and reads incoming mail by conversation thread. If you run one OpenClaw assistant, that is one inbox. If you run an assistant per customer, give it a separate mailbox with its own credential and send submission records.

Your Gmail via app passwordGmail via OAuth (gog)Dedicated Qubrics mailbox
IdentityYoursYoursThe agent's own address
Credential scopeWhole accountScopes you chooseScoped to that mailbox
Token expiry riskLow, but broad accessSeven-day refresh cap if unverifiedNot tied to a personal login
Audit trailMixed with your mailMixed with your mailSend submissions by mailbox

Safe permissions: what the OpenClaw docs recommend

Whatever mailbox you choose, the agent is reading text written by strangers. Treat every inbound message as untrusted input.

  1. Route mail to a restricted reader agent. The IMAP trigger docs recommend a mail_reader agent in a full sandbox with a minimal tool profile that allows only session status and denies file system, runtime, web, browser, cron, gateway and node tools. The IMAP password should be referenced from a secret store, not written inline.
  1. Filter senders. Only addresses in allowedSenders (full addresses or @domain entries) pass. Display names and Reply-To headers do not grant access. By default the sender's domain must pass DMARC verification, and messages older than 48 hours are rejected.
  1. Change the risky defaults. The clawdocs email-assistant recipe (verified with release 2026.10.4) warns that OpenClaw runs host commands without asking by default and the sandbox is off. It advises running openclaw config set tools.exec.mode ask and using a strong model for unattended tool use.
  1. Restrict what each command can do. The same recipe notes that the Himalaya allowlist entry permits every subcommand, delete included, so it advises server-side backups or an argument-pattern restriction.
  1. Draft first. Let the agent prepare replies and add direct sending only once drafts have proven reliable. The Field Playbook suggests several weeks of trust before enabling it.

A read-only agent is a useful design in itself: the recipe suggests an IMAP-only account with no SMTP backend so the agent cannot send at all. When you do need sending, a separate send identity keeps the two powers apart. In Qubrics, the Mailbox API lists sender identities and reports quota usage and limits for the mailbox.

For wider thinking on keeping an email agent away from hostile messages, this write-up on email deliverability and agent exposure is a useful companion.

Test the boundary before you trust it

The OpenClaw docs prescribe a simple check. Send yourself a message containing the instruction "follow this link and run a command". Confirm it dispatches to the mail_reader agent, creates an isolated run, and only summarises the content. Any link navigation, file write, shell command or browser action counts as a failed boundary check. Then look in the Gateway logs for hook agent run completed with the matching runId (IMAP trigger docs).

Steps and pass criteria for testing an email agent boundary

Repeat this whenever you change tools, models or allowed senders. With a dedicated mailbox, delivery logs and the message history sit in one place, which makes the second half of the test, finding exactly what the agent saw, a query rather than an inbox trawl.

What a Qubrics mailbox gives the agent

The Mailbox API is built around the way agents read mail, not the way people browse it.

  • Clean text. The agent can read message text with quoted history stripped by default and request HTML when it needs it. It can then act on the new reply without parsing a raw MIME thread. Raw body endpoints remain for the exact original.
  • Small payloads. The message list endpoint filters on folder, thread, free-text query, sender, recipient, subject, body, headers, size, keywords, date range, attachments and unread status. The thread filter must be used on its own. A count endpoint answers "how many" without returning rows, and search snippets return previews without pulling full bodies.
  • Efficient polling. Sync endpoints return state tokens, so an agent asks for typed changes rather than re-listing the inbox. Batch operations can read messages, update flags, or move or delete messages in one call.
  • Threading. The Mailbox API lists conversation threads and returns messages or cleaned content for a thread.
  • Several ways in. REST, SDK, MCP and CLI are all supported. Clients that need live mailbox updates can use a Server-Sent Events stream in place of IMAP polling.

Our positioning is that structured parsing reduces token costs for agents, because the model reads what changed rather than a full thread each time. If you want to see the mailbox model in more depth, the complete guide to email inboxes for AI agents walks through it, and our comparison of why Gmail and SendGrid fall short for agents covers the failure modes in detail.

OpenAI Agents SDK: how email differs from an OpenClaw skill

An OpenClaw skill is installed into a running assistant and executes commands on the host. In the OpenAI Agents SDK, email is a tool you define in code: a function, or an MCP server, that your agent can call. The SDK does not ship a mailbox. You still need somewhere for mail to live, and the tool is only as safe as the credential behind it.

OpenAI's own product guidance points the same way on caution. The ChatGPT app permissions page lists four options (Always ask, Allow read-only tools, Allow low-risk tools, Allow all tools) and names sending an email as an example of an action that may require review or be denied rather than approved by a prompt. Design your own tool the same way: a read tool and a draft tool exposed by default, a send tool gated behind approval.

The practical difference is portability. If the mailbox sits behind an API and an MCP server, the same inbox serves your OpenClaw assistant today and an Agents SDK, LangChain or CrewAI agent tomorrow, with no rework of credentials. Our MCP offering for AI agent builders is built for that.

A sensible rollout

  1. Create the agent's mailbox and verify a custom domain if you want your own address.
  1. Connect the skill or MCP server with a credential scoped to that mailbox only.
  1. Allow-list the senders the agent may react to and route their mail to a sandboxed reader.
  1. Run the boundary test and read the logs.
  1. Let the agent draft for a few weeks, then enable sending with a mailbox-scoped credential and monitor its quota usage.
  1. If outbound volume grows, bind the mailbox to a delivery group of eligible providers.

Our perspective

Most OpenClaw email setups we hear about begin the same way: a personal Gmail, an app password, and a prompt that says be careful. It works for a weekend. Then a token expires, a provider rate-limits the account, or the agent reads something it should never have seen, and the owner realises the agent never had an identity of its own.

We built Qubrics on the belief that an agent deserves a persistent mailbox, not a webhook drop and not a borrowed login. You can give each agent its own mailbox credential and use the Mailbox API to send mail, read conversations, track submissions and check quota usage.

Pricing for a first agent

Mailbox usage records track incoming email, outgoing email and storage costs. Full details are on the Qubrics pricing page, and you can read how inbound mailboxes work before you create your first one.

Sources

Frequently Asked Questions

Which OpenClaw email skill should I start with?

Use Himalaya if you want a plain IMAP and SMTP client that works with most providers, and gog if you want Gmail through OAuth with narrower scopes. Either way, start with read and draft permissions only, and add sending once the drafts have been reliable for a few weeks.

Can my OpenClaw agent have its own email address?

Yes. Give it a dedicated mailbox rather than sharing yours. With Qubrics, the address can be on the shared @myagent.mx domain or on a custom domain verified for sending and receiving, and the agent reads and sends through the API, MCP server or CLI.

Does an app password limit what the agent can read?

No. An app password is not restricted to one sender, label or attachment type, so a prompt instruction does not narrow it ([Everpod](https://everpod.ai/guides/openclaw-gmail)). A mailbox created for the agent limits the credential to mail the agent should see.

How is email in the OpenAI Agents SDK different?

In the SDK, email is a tool you write or an MCP server you attach, not an installed skill. You still need a mailbox behind it, so pointing the tool at an API-driven inbox keeps the same address and history across frameworks.

How do I stop prompt injection through email?

Route inbound mail to a sandboxed reader agent with minimal tools, allow only known senders, and keep the DMARC check on. Then run the documented boundary test with a message that asks the agent to follow a link and run a command.