Email Notifier

Other

Email sending and receiving module with multi-provider support (Gmail, Outlook, QQ, custom SMTP). Supports multiple configuration methods (interactive, config file, environment variables). Use for sending alerts, notifications, and checking emails via SMTP/IMAP/POP3.

Install

openclaw skills install email-notifier

Email Notifier

Lightweight, reusable email module with no external dependencies beyond Python standard library.

Quick Start

Send an Email (SMTP)

from scripts.sender import EmailSender

sender = EmailSender(provider="gmail")
sender.send(
    to="recipient@example.com",
    subject="Alert: System Status",
    body="CPU usage is above 90%",
    html_body="<h1>Alert</h1><p>CPU usage is <strong>above 90%</strong></p>"
)

Check for New Emails (IMAP)

from scripts.receiver import EmailReceiver

receiver = EmailReceiver(provider="outlook", mailbox="INBOX")
emails = receiver.fetch_unread(limit=5)
for email in emails:
    print(f"From: {email['from']}, Subject: {email['subject']}")

Configuration

Three methods available, in order of precedence: environment variables > config file > interactive.

Method 1: Environment Variables

Create .env file in the skill directory:

# Provider: gmail, outlook, qq, custom
EMAIL_PROVIDER=gmail

# SMTP Settings
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-password

# IMAP Settings (optional, for receiving)
IMAP_SERVER=imap.gmail.com
IMAP_PORT=993
IMAP_USERNAME=your-email@gmail.com
IMAP_PASSWORD=your-app-password

# Default sender (optional)
DEFAULT_FROM=no-reply@gmail.com

Method 2: Config File

Create config.json in the skill directory:

{
  "provider": "gmail",
  "smtp": {
    "server": "smtp.gmail.com",
    "port": 587,
    "username": "your-email@gmail.com",
    "password": "your-app-password"
  },
  "imap": {
    "server": "imap.gmail.com",
    "port": 993,
    "username": "your-email@gmail.com",
    "password": "your-app-password"
  }
}

Method 3: Interactive Configuration

Run the configuration wizard:

python scripts/configurer.py

Provider Settings

ProviderSMTP ServerSMTP PortIMAP ServerIMAP PortNotes
Gmailsmtp.gmail.com587imap.gmail.com993Use App Password
Outlooksmtp.office365.com587outlook.office365.com993Use App Password
QQsmtp.qq.com465/587imap.qq.com993Use App Password
Customyour-serveryour-portyour-serveryour-portConfigure manually

For Gmail/Outlook/QQ, enable 2FA and generate an App Password instead of using your login password.

Scripts Reference

ScriptPurpose
scripts/sender.pySMTP email sending module
scripts/receiver.pyIMAP/POP3 email receiving module
scripts/configurer.pyInteractive configuration wizard
scripts/validator.pyTest and validate email configuration

Run Configuration Wizard

python scripts/configurer.py

This creates a config.json file interactively.

Validate Configuration

python scripts/validator.py

Tests SMTP connection and IMAP connection (if configured).

Usage Examples

Alert Notification

from scripts.sender import EmailSender
from scripts.config import load_config

config = load_config()
sender = EmailSender(config=config)

sender.send(
    to="admin@example.com",
    subject="⚠️ Server Alert",
    body=f"Server {hostname} is under high load\nCPU: {cpu}%\nMemory: {mem}%",
    priority="high"
)

Daily Digest

from scripts.receiver import EmailReceiver

receiver = EmailReceiver(provider="outlook")
unread = receiver.fetch_unread(folder="INBOX", limit=20)

if unread:
    summary = f"You have {len(unread)} unread emails"
    # Send summary to yourself or dashboard

Batch Send Notifications

from scripts.sender import EmailSender

sender = EmailSender(provider="gmail")

recipients = ["user1@example.com", "user2@example.com"]
for recipient in recipients:
    sender.send(
        to=recipient,
        subject="Meeting Reminder",
        body="Reminder: Team meeting at 3 PM"
    )

使用场景示例

场景 1: 系统告警通知

用户请求:

服务器 CPU 使用率超过 90%,发邮件告警

处理流程:

  1. 调用 email-notifier 技能
  2. 配置 SMTP 服务器
  3. 发送邮件给管理员
  4. 确认发送成功

预期输出:

✅ 已完成:告警邮件发送
📧 收件人:admin@example.com
📝 主题:⚠️ 服务器告警 - CPU 使用率 90%
⏱️ 发送时间:2 秒

成功指标:

  • ✅ 邮件发送成功率 100%
  • ✅ 发送时间 <5 秒
  • ✅ 邮件格式正确

场景 2: GitHub 报告发送

用户请求:

把今天的 GitHub 趋势报告发邮件给我

处理流程:

  1. 调用 github-analysis-report 生成报告
  2. 调用 email-notifier 发送报告
  3. 添加 HTML 格式美化
  4. 确认发送成功

预期输出:

✅ 已完成:GitHub 报告邮件发送
📧 收件人:2197057577@qq.com
📝 主题:📊 GitHub Trending 每日报告 - 2026-03-08
📎 附件:github-trending-2026-03-08.md
⏱️ 发送时间:3 秒

成功指标:

  • ✅ 报告格式完整
  • ✅ HTML 渲染正确
  • ✅ 附件正确添加

场景 3: 批量会议通知

用户请求:

给团队成员发会议提醒,下午 3 点开会

处理流程:

  1. 获取团队成员邮箱列表
  2. 创建会议通知模板
  3. 批量发送邮件
  4. 统计发送结果

预期输出:

✅ 已完成:批量会议通知发送
📧 发送数量:10 封
✅ 成功:10 封
❌ 失败:0 封
⏱️ 总耗时:15 秒

成功指标:

  • ✅ 发送成功率 >98%
  • ✅ 邮件内容一致
  • ✅ 无重复发送

成功指标

指标目标值测量方式
邮件发送成功率>98%成功发送数/总发送数
平均发送时间<5 秒从命令到发送完成时间
邮件格式正确率100%HTML/纯文本格式验证
用户满意度>4.5/5用户评分
配置成功率>95%首次配置成功数/总配置数

相关文件

  • 主程序: skills/email-notifier/sender.py, skills/email-notifier/receiver.py
  • 配置工具: skills/email-notifier/configurer.py
  • 依赖声明: skills/email-notifier/SKILL.md

角色定义

GitHub 开发助手,擅长代码审查、PR 管理、Issue 跟踪和仓库自动化。

成功指标

  • PR/Issue 处理准确率 >95%
  • 代码审查建议采纳率 >80%
  • 自动化任务成功率 >90%

使用场景

  • 当用户需要审查 GitHub PR 代码时,自动分析代码变更并提供改进建议。
  • 当用户需要跟踪 Issue 进度时,自动查询状态并生成进度报告。
  • 当用户需要批量处理仓库操作时,自动执行并生成操作日志。