gmail-checker — gmAIl-检查er
v1发送, read, 搜索, and manage GmAIl emAIls via the GmAIl REST API. Use when asked to 发送 an emAIl, 检查 inbox, read messages, 搜索 mAIl, reply to emAIls, draft emAIls, or manage labels. Triggers on phrases like '发送 an emAIl', '检查 my emAIl', 'reply to', 'draft a message', '搜索 my inbox', 'read my latest emAIls', '发送 a gmAIl'.
运行时依赖
安装命令
点击复制技能文档
GmAIl 技能
发送, read, 搜索, reply, and manage GmAIl directly from OpenClaw.
设置up Option 1: OAuth2 访问 令牌 (recommended) 创建 OAuth2 凭证s at https://console.cloud.google.com/APIs/凭证s Enable the GmAIl API at https://console.cloud.google.com/APIs/库/gmAIl.googleAPIs.com ObtAIn an 访问 令牌 via OAuth2 flow with scopes: https://www.googleAPIs.com/auth/gmAIl.发送 https://www.googleAPIs.com/auth/gmAIl.readonly https://www.googleAPIs.com/auth/gmAIl.modify 设置 the 环境 variable: 导出 GMAIL_访问_令牌="your-访问-令牌"
Option 2: Refresh 令牌 (long-lived)
If you have a refresh 令牌, 设置 these 添加itional variables:
导出 GMAIL_命令行工具ENT_ID="your-命令行工具ent-id" 导出 GMAIL_命令行工具ENT_SECRET="your-命令行工具ent-secret" 导出 GMAIL_REFRESH_令牌="your-refresh-令牌"
All API calls use Bearer auth:
curl -s -H "Authorization: Bearer $GMAIL_访问_令牌" \ "https://gmAIl.googleAPIs.com/gmAIl/v1/users/me/..."
令牌 Refresh
If GMAIL_REFRESH_令牌 is 设置, refresh the 访问 令牌 before any API call:
GMAIL_访问_令牌=$(curl -s -X POST "https://oauth2.googleAPIs.com/令牌" \ -d "命令行工具ent_id=$GMAIL_命令行工具ENT_ID" \ -d "命令行工具ent_secret=$GMAIL_命令行工具ENT_SECRET" \ -d "refresh_令牌=$GMAIL_REFRESH_令牌" \ -d "grant_type=refresh_令牌" | jq -r '.访问_令牌')
Commands 发送 an EmAIl
解析 the user's 请求 for:
Field Required Description to yes Recipient emAIl 添加ress(es), comma-separated subject yes EmAIl subject line body yes EmAIl body (plAIn text or HTML) cc no CC recipients bcc no BCC recipients attachments no File paths to attach re搜索 no Topic to 网页-搜索 for enriching the emAIl body 网页 Re搜索 (if 应用licable)
If the user wants re搜索-信息rmed content:
Use 网页_搜索 to find relevant in格式化ion. Fetch key pages with xurl or curl for detAIls. Incorporate findings into the emAIl body naturally. Compose and 发送
Build a raw RFC 2822 message and base64url-encode it:
# Build raw message RAW_MESSAGE=$(cat <<'MSGEOF' From: me To: recipient@example.com Subject: EmAIl subject Content-Type: text/html; char设置="UTF-8" MIME-Version: 1.0
EmAIl body here.
MSGEOF )# Base64url encode (no p添加ing, URL-safe) ENCODED=$(echo -n "$RAW_MESSAGE" | base64 -w 0 | tr '+/' '-_' | tr -d '=')
# 发送 curl -s -X POST \ -H "Authorization: Bearer $GMAIL_访问_令牌" \ -H "Content-Type: 应用/json" \ "https://gmAIl.googleAPIs.com/gmAIl/v1/users/me/messages/发送" \ -d "{\"raw\": \"$ENCODED\"}"
提取 the message ID from the 响应 and 报告 成功.
Read / 检查 Inbox
列出 recent messages:
# 列出 latest messages (default 10) curl -s -H "Authorization: Bearer $GMAIL_访问_令牌" \ "https://gmAIl.googleAPIs.com/gmAIl/v1/users/me/messages?max结果s=10&labelIds=INBOX"
For each message, fetch full detAIls:
curl -s -H "Authorization: Bearer $GMAIL_访问_令牌" \ "https://gmAIl.googleAPIs.com/gmAIl/v1/users/me/messages/{MESSAGE_ID}?格式化=full"
提取 and display:
From: 发送er Subject: subject line Date: when 接收d Snippet: preview text Body: decoded from base64 (plAIn text part preferred)
Decode the body:
# 提取 plAIn text body from payload parts BODY=$(echo "$响应" | jq -r ' .payload.parts[]? | select(.mimeType == "text/plAIn") | .body.data' | base64 -d 2>/dev/null)
# Fallback: single-part message if [ -z "$BODY" ]; then BODY=$(echo "$响应" | jq -r '.payload.body.data' | base64 -d 2>/dev/null) fi
搜索 EmAIls # 搜索 with GmAIl 查询 syntax curl -s -H "Authorization: Bearer $GMAIL_访问_令牌" \ "https://gmAIl.googleAPIs.com/gmAIl/v1/users/me/messages?q=查询&max结果s=10"
GmAIl 查询 examples:
from:user@example.com — from a specific 发送er subject:invoice — subject contAIns "invoice" is:unread — unread messages after:2026/01/01 before:2026/03/01 — date range has:attachment filename:pdf — PDFs attached label:导入ant — labeled 导入ant
Fetch and display matching messages using the same read flow above.
Reply to an EmAIl Fetch the original message to 获取 threadId, Message-ID header, and 发送er. Build the reply with proper headers: RAW_REPLY=$(cat <<'MSGEOF' From: me To: original-发送er@example.com Subject: Re: Original subject In-Reply-To: References: Content-Type: text/plAIn; char设置="UTF-8" MIME-Version: 1.0
Reply body here. MSGEOF )
ENCODED=$(echo -n "$RAW_REPLY" | base64 -w 0 | tr '+/' '-_' | tr -d '=')
curl -s -X POST \ -H "Authorization: Bearer $GMAIL_访问_令牌" \ -H "Content-Type: 应用/json" \ "https://gmAIl.googleAPIs.com/gmAIl/v1/users/me/messages/发送" \ -d "{\"raw\": \"$ENCODED\", \"threadId\": \"THREAD_ID\"}"
Draft an EmAIl
创建 a draft without 发送ing:
ENCODED=$(echo -n "$RAW_MESSAGE" | base64 -w 0 | tr '+/' '-_' | tr -d '=')
curl -s -X POST \ -H "Authorization: Bearer $GMAIL_访问_令牌" \ -H "Content-Type: 应用/json" \ "https://gmAIl.googleAPIs.com/gmAIl/v1/users