/install gmail-imap
Gmail IMAP Skill
All Gmail access uses IMAP. Credentials are read from environment variables — never printed.
Requirements
Set these environment variables before use:
| Variable | Description |
|---|---|
GMAIL_IMAP_USER |
Your Gmail address (e.g. [email protected]) |
GMAIL_IMAP_PASSWORD |
A Google App Password (not your account password) |
Generate an App Password at: https://myaccount.google.com/apppasswords (requires 2FA enabled)
Quick Reference
# Locate the script (adjust SKILL_DIR to match your install location):
# Default: ~/.openclaw/skills/gmail-imap
# Custom: \x3Cworkspace>/skills/gmail-imap
SCRIPT="$SKILL_DIR/scripts/gmail_imap.py"
# List inbox (most recent 20)
"$SCRIPT" list
# List with custom limit
"$SCRIPT" list --limit 50
# List unread only (shorthand)
"$SCRIPT" list --unread
# List unread with limit
"$SCRIPT" list --unread --limit 10
# Search by sender (IMAP header search)
"$SCRIPT" list --search 'FROM "[email protected]"'
# Full-text search (Gmail X-GM-RAW — searches body + headers)
"$SCRIPT" search "invoice"
"$SCRIPT" search "from:[email protected] is:unread" --limit 5
"$SCRIPT" search "subject:meeting this week"
# Read a message (by UID shown in list output)
"$SCRIPT" read \x3Cuid>
# Read from a specific folder
"$SCRIPT" read \x3Cuid> --folder "[Gmail]/All Mail"
# Delete (moves to [Gmail]/Trash — correct Gmail deletion)
"$SCRIPT" trash \x3Cuid>
# Move to a label/folder
"$SCRIPT" move \x3Cuid> "Work"
# Send email
"$SCRIPT" send --to [email protected] --subject "Hello" --body "Message text"
Deletion Rule (Critical)
Never use the standard IMAP \Deleted flag on Gmail — it only archives, it does not delete.
Always use trash \x3Cuid> which moves to [Gmail]/Trash. The script handles this correctly.
Credentials
Set in env (never output raw password):
GMAIL_IMAP_USER— Gmail addressGMAIL_IMAP_PASSWORD— App password (generate at myaccount.google.com/apppasswords)
Reference
For folder names, search syntax, direct Python IMAP usage, and connection details: → See references/gmail-imap-reference.md
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install gmail-imap - 安装完成后,直接呼叫该 Skill 的名称或使用
/gmail-imap触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Gmail IMAP 是什么?
Read, search, send, trash, move, and label Gmail via IMAP. Requires GMAIL_IMAP_USER (Gmail address) and GMAIL_IMAP_PASSWORD (Google App Password) environment... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 67 次。
如何安装 Gmail IMAP?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install gmail-imap」即可一键安装,无需额外配置。
Gmail IMAP 是免费的吗?
是的,Gmail IMAP 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Gmail IMAP 支持哪些平台?
Gmail IMAP 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Gmail IMAP?
由 scottgl9(@scottgl9)开发并维护,当前版本 v1.1.1。