Gmail 工具:自动化邮件收发 - Openclaw 技能库
作者:互联网
2026-04-15
什么是 Gmail 工具?
Gmail 工具是一款功能强大的命令行界面,旨在为开发人员和自动化系统简化邮件交互。作为 Openclaw 技能生态系统的一部分,该工具在您的本地环境与 Gmail 基础设施之间架起了一座桥梁,允许将电子邮件功能无缝集成到任何工作流中。它简化了 SMTP 和 IMAP 协议的复杂性,提供了一套统一的命令集来管理通信。
通过使用此技能,用户可以通过编程方式发送警报、监控收到的邮件并创建自动响应系统。它的构建专注于简洁性和安全性,确保您的自动化流程在遵守 Google 应用专用密码等现代身份验证标准的同时保持可靠。
下载入口:https://github.com/openclaw/skills/tree/main/skills/junkaixue/gmail-tool
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install gmail-tool
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 gmail-tool。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Gmail 工具 应用场景
- 向管理员发送自动系统警报和通知。
- 使用 Openclaw 技能监控收件箱中的特定关键词或触发器。
- 将电子邮件功能集成到日常计划任务(cron jobs)中进行自动报告。
- 为 AI 代理工作流构建自定义通知桥接。
- 该工具使用提供的环境凭据初始化与 Gmail 的安全连接。
- 对于外发邮件,它利用 SMTP 协议将主题和正文传输给指定的收件人。
- 对于收到的查询,它建立 IMAP 连接以获取并解析收件箱中最近的邮件。
- 用户通过简单的 CLI 命令与工具交互,指定收件人地址或要获取的邮件数量等参数。
- 与 Openclaw 技能的集成确保了该过程针对代理工作流和自动化进行了优化。
Gmail 工具 配置指南
要开始使用,请先在您的 Google 帐号中启用两步验证并生成一个 16 位的“应用专用密码”。如下配置您的环境变量:
export GMAIL_USER="your-email@gmail.com"
export GMAIL_APP_PASSWORD="xxxxxxxxxxxxxxxx"
使用 ClawHub 安装该工具或将其复制到本地目录:
clawhub install gmail-tool
Gmail 工具 数据架构与分类体系
Gmail 工具主要处理瞬态电子邮件数据,并依赖于基于环境的配置来确保安全性。以下是该技能使用的元数据分类:
| 属性 | 类型 | 描述 |
|---|---|---|
| GMAIL_USER | 字符串 | 用于身份验证的 Gmail 地址。 |
| GMAIL_APP_PASSWORD | 字符串 | 用于应用访问的安全 16 位令牌。 |
| 命令类型 | 枚举 | 定义操作:发送或读取。 |
| 读取数量 | 整数 | 从服务器获取的最近邮件数量。 |
Gmail Tool
Send and read emails via Gmail using App Password. CLI utility for automated alerts, notifications, and email monitoring.
Overview
A CLI tool to send and read emails through Gmail. Combines SMTP (send) and IMAP (read) in one utility.
Requirements
- Python 3.6+
- Gmail account with App Password enabled
Setup
-
Enable 2-Factor Authentication on your Google Account:
- Go to https://myaccount.google.com/security
-
Generate an App Password:
- Go to https://myaccount.google.com/apppasswords
- Select "Mail" as the app
- Copy the 16-character password (no spaces)
-
Set environment variables:
export GMAIL_USER="your-email@gmail.com"
export GMAIL_APP_PASSWORD="xxxxxxxxxxxxxxxx"
Installation
# Clone or copy to skills directory
cp -r gmail-tool ~/.openclaw/workspace/skills/
# Or use ClawHub
clawhub install gmail-tool
Usage
Send Email
chmod +x gmail-tool
./gmail-tool send "recipient@example.com" "Subject" "Body text"
Read Emails
# Read last 5 emails
./gmail-tool read
# Read last 10 emails
./gmail-tool read 10
Examples
# Send notification
./gmail-tool send "admin@example.com" "Alert" "Server down!"
# Check inbox
./gmail-tool read 3
# Cron job - check and alert
0 9 * * 1-5 ./gmail-tool read 1 | grep -q "Important" && ./gmail-tool send "you@example.com" "Check Email" "Found important email"
Commands
| Command | Usage |
|---|---|
send |
Send an email |
read [count] |
Read last N emails (default: 5) |
Environment Variables
| Variable | Required | Description |
|---|---|---|
| GMAIL_USER | Yes | Your Gmail address |
| GMAIL_APP_PASSWORD | Yes | 16-char App Password |
Security Notes
- Never commit App Passwords to version control
- Use environment variables, never hardcode credentials
- App Passwords are 16 characters (no spaces)
- Revoke app passwords if compromised
Troubleshooting
Send failed: "535 5.7.8 Username and Password not accepted"
- Verify App Password is correct
- Make sure 2FA is enabled
Read failed: "Too many simultaneous connections"
- Gmail limits IMAP connections. Wait and retry.
License
MIT
Author
junkaixue
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
Minecraft 3D 建造计划生成器:AI 场景架构师 - Openclaw Skills
Scholar Search:自动化文献搜索与研究简报 - Openclaw Skills
issue-to-pr: 自动化 GitHub Issue 修复与 PR 生成 - Openclaw Skills
接班交班总结器:临床 EHR 自动化 - Openclaw Skills
Teacher AI 备课专家:K-12 自动化教案设计 - Openclaw Skills
专利权利要求映射器:生物技术与制药 IP 分析 - Openclaw Skills
生成 Tesla 车身改色膜:用于 3D 显示的 AI 图像生成 - Openclaw Skills
Taiwan MD:面向台湾的 AI 原生开放知识库 - Openclaw Skills
自学习与迭代演进:AI Agent 成长框架 - Openclaw Skills
HIPC Config Manager: 安全的 API 凭据处理器 - Openclaw Skills
AI精选
