← 返回
沟通协作 Key 中文

Gmail Sender

Send emails via Gmail SMTP using a Python CLI tool with Google App Password for alerts, notifications, and automated reports.
使用 Python CLI 工具通过 Gmail SMTP 发送邮件,配合 Google 应用密码实现警报、通知和自动化报告。
junkaixue
沟通协作 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 1,056
下载
💾 25
安装
1
版本
#latest

概述

Gmail Sender Skill

Send emails via Gmail SMTP using Google App Password. Generic utility for alerts, notifications, and automated reports.

Overview

A simple CLI tool to send emails through Gmail SMTP. No external dependencies beyond Python standard library.

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 this skill to your OpenClaw skills directory:

cp -r gmail-sender ~/.openclaw/workspace/skills/

Or use the CLI:

clawhub install gmail-sender

Usage

# Make executable
chmod +x gmail-send

# Send email
./gmail-send "recipient@example.com" "Subject" "Body text"

Examples

# Simple notification
./gmail-send "admin@example.com" "Server Alert" "CPU usage at 90%"

# Cron job integration
0 9 * * 1-5 ~/.openclaw/scripts/gmail-send "you@example.com" "Morning Report" "$(date)"

Python Module Usage

import subprocess

# Call from Python
subprocess.run([
    './gmail-send',
    'recipient@example.com',
    'Subject',
    'Body'
], env={'GMAIL_USER': '...', 'GMAIL_APP_PASSWORD': '...'})

Security Notes

  • Never commit App Passwords to version control
  • Use environment variables, never hardcode credentials
  • App Passwords are 16 characters (format: xxxx xxxx xxxx xxxx)
  • Revoke app passwords if compromised

Troubleshooting

"535 5.7.8 Username and Password not accepted"

  • Verify App Password is correct (16 chars, no spaces)
  • Make sure 2FA is enabled on your Google account

"Could not connect"

  • Check firewall/network settings
  • Gmail may block connections from unknown apps

License

MIT

Author

junkaixue

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 14:38 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,585
communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,678
communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 113 📥 52,404