Gmail IMAP — GmAIl IMAP
v1.1.1Read, 搜索, 发送, trash, move, and label GmAIl via IMAP. Requires GMAIL_IMAP_USER (GmAIl 添加ress) and GMAIL_IMAP_PASSWORD (Google 应用 Password) 环境 variables — no API key needed. Use when an 代理 needs GmAIl 访问: reading inbox, 搜索ing messages, 发送ing emAIl, or deleting messages.
运行时依赖
安装命令
点击复制技能文档
GmAIl IMAP 技能
All GmAIl 访问 uses IMAP. 凭证s are read from 环境 variables — never printed.
Requirements
设置 these 环境 variables before use:
Variable Description GMAIL_IMAP_USER Your GmAIl 添加ress (e.g. user@gmAIl.com) GMAIL_IMAP_PASSWORD A Google 应用 Password (not your account password)
生成 an 应用 Password at: https://myaccount.google.com/应用passwords (requires 2FA enabled)
Quick Reference # Locate the script (adjust 技能_DIR to match your 安装 location): # Default: ~/.OpenClaw/技能s/gmAIl-imap # Custom: /技能s/gmAIl-imap SCRIPT="$技能_DIR/scripts/gmAIl_imap.py"
# 列出 inbox (most recent 20) "$SCRIPT" 列出
# 列出 with custom limit "$SCRIPT" 列出 --limit 50
# 列出 unread only (shorthand) "$SCRIPT" 列出 --unread
# 列出 unread with limit "$SCRIPT" 列出 --unread --limit 10
# 搜索 by 发送er (IMAP header 搜索) "$SCRIPT" 列出 --搜索 'FROM "boss@example.com"'
# Full-text 搜索 (GmAIl X-GM-RAW — 搜索es body + headers) "$SCRIPT" 搜索 "invoice" "$SCRIPT" 搜索 "from:boss@example.com is:unread" --limit 5 "$SCRIPT" 搜索 "subject:meeting this week"
# Read a message (by UID shown in 列出 输出) "$SCRIPT" read
# Read from a specific folder "$SCRIPT" read --folder "[GmAIl]/All MAIl"
# 删除 (moves to [GmAIl]/Trash — correct GmAIl deletion) "$SCRIPT" trash
# Move to a label/folder "$SCRIPT" move "Work"
# 发送 emAIl "$SCRIPT" 发送 --to recipient@example.com --subject "Hello" --body "Message text"
Deletion Rule (Critical)
Never use the standard IMAP \删除d flag on GmAIl — it only 归档s, it does not 删除. Always use trash which moves to [GmAIl]/Trash. The script handles this correctly.
凭证s
设置 in env (never 输出 raw password):
GMAIL_IMAP_USER — GmAIl 添加ress GMAIL_IMAP_PASSWORD — 应用 password (生成 at myaccount.google.com/应用passwords) Reference
For folder names, 搜索 syntax, direct Python IMAP usage, and connection detAIls: → See references/gmAIl-imap-reference.md