← 返回
未分类 Key 中文

Gmail Tool

Send and read Gmail messages via CLI using App Password, supporting SMTP for sending and IMAP for reading emails.
使用 App 密码通过命令行发送和读取 Gmail 邮件,支持 SMTP 发送和 IMAP 读取。
junkaixue junkaixue 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 197
下载
💾 0
安装
1
版本
#latest

概述

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

  1. Enable 2-Factor Authentication on your Google Account:
    • Go to https://myaccount.google.com/security
  1. Generate an App Password:
    • Go to https://myaccount.google.com/apppasswords
    • Select "Mail" as the app
    • Copy the 16-character password (no spaces)
  1. Set environment variables:
  2. 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

CommandUsage
----------------
send Send an email
read [count]Read last N emails (default: 5)

Environment Variables

VariableRequiredDescription
---------------------------------
GMAIL_USERYesYour Gmail address
GMAIL_APP_PASSWORDYes16-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

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-12 06:07 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

office-efficiency

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 387 📥 147,376
office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 464 📥 155,058
office-efficiency

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 932 📥 187,328