🦀 ClawHub
email-reporter
by @dirkcaiusa
Generic email reporting tool for OpenClaw agents. Auto-converts Markdown to PDF and sends as attachments.
TERMINAL
clawhub install email-reporter📖 About This Skill
name: email-reporter description: Generic email reporting tool for OpenClaw agents. Auto-converts Markdown to PDF and sends as attachments. version: 2.0.0 author: dirkcaiusa license: MIT metadata: {"openclaw":{"requires":{"bins":["python3"],"pip":["markdown","weasyprint"]}}}
Email Reporter Skill
Overview
A unified email reporting tool for OpenClaw agents. Automatically converts Markdown reports to PDF when images are detected, and sends them as attachments.Features
Installation
clawhub install email-reporter
Configuration
Option 1: Environment Variables (Recommended)
export EMAIL_SENDER="your-email@qq.com"
export EMAIL_RECIPIENT="recipient@example.com"
export EMAIL_SMTP_HOST="smtp.qq.com"
export EMAIL_SMTP_PORT="587"
export EMAIL_SMTP_USER="your-email@qq.com"
export EMAIL_SMTP_PASS="your-auth-code"
Option 2: Config File
Create ~/.email_reporter.conf:
{
"sender": "your-email@qq.com",
"recipient": "recipient@example.com",
"smtp_host": "smtp.qq.com",
"smtp_port": 587,
"smtp_user": "your-email@qq.com",
"smtp_pass": "your-auth-code",
"use_msmtp": false
}
Option 3: Command Line
python3 email_reporter.py report.md --sender me@qq.com --to friend@example.com
Usage
Basic Usage
# Send report to default recipient
python3 email_reporter.py report.mdSpecify agent name (used in subject)
python3 email_reporter.py report.md --agent "my-agent"Custom recipient
python3 email_reporter.py report.md --to "friend@example.com"Custom subject
python3 email_reporter.py report.md --subject "My Analysis Report"
In Your Agent
import subprocessSend a report
subprocess.run([
"python3", "skills/email-reporter/email_reporter.py",
"reports/analysis.md",
"--agent", "invest-agent",
"--to", "recipient@example.com"
])
File Format Selection
| Scenario | Format | Delivery | |----------|--------|----------| | Plain text (<100KB) | Markdown | Direct | | With images or >500KB | PDF | Attachment | | Data tables | Markdown + CSV | Attachment bundle |
SMTP Setup Guide
QQ Mail (腾讯)
1. Enable SMTP: 设置 → 账户 → 开启SMTP服务 2. Generate auth code (not your password!) 3. Use auth code asEMAIL_SMTP_PASSGmail
1. Enable 2FA 2. Generate App Password 3. Use app password asEMAIL_SMTP_PASSOutlook/Office 365
export EMAIL_SMTP_HOST="smtp.office365.com"
export EMAIL_SMTP_PORT="587"
Troubleshooting
Email not sending
# Test SMTP connection
python3 -c "
import smtplib
s = smtplib.SMTP('smtp.qq.com', 587)
s.starttls()
s.login('your-email@qq.com', 'your-auth-code')
print('Login OK')
"
PDF conversion fails
# Install dependencies
pip install markdown weasyprintFor Linux (Ubuntu/Debian)
sudo apt-get install libpango-1.0-0 libpangoft2-1.0-0
License
MIT
💡 Examples
Basic Usage
# Send report to default recipient
python3 email_reporter.py report.mdSpecify agent name (used in subject)
python3 email_reporter.py report.md --agent "my-agent"Custom recipient
python3 email_reporter.py report.md --to "friend@example.com"Custom subject
python3 email_reporter.py report.md --subject "My Analysis Report"
In Your Agent
import subprocessSend a report
subprocess.run([
"python3", "skills/email-reporter/email_reporter.py",
"reports/analysis.md",
"--agent", "invest-agent",
"--to", "recipient@example.com"
])
⚙️ Configuration
Option 1: Environment Variables (Recommended)
export EMAIL_SENDER="your-email@qq.com"
export EMAIL_RECIPIENT="recipient@example.com"
export EMAIL_SMTP_HOST="smtp.qq.com"
export EMAIL_SMTP_PORT="587"
export EMAIL_SMTP_USER="your-email@qq.com"
export EMAIL_SMTP_PASS="your-auth-code"
Option 2: Config File
Create ~/.email_reporter.conf:
{
"sender": "your-email@qq.com",
"recipient": "recipient@example.com",
"smtp_host": "smtp.qq.com",
"smtp_port": 587,
"smtp_user": "your-email@qq.com",
"smtp_pass": "your-auth-code",
"use_msmtp": false
}
Option 3: Command Line
python3 email_reporter.py report.md --sender me@qq.com --to friend@example.com
📋 Tips & Best Practices
Email not sending
# Test SMTP connection
python3 -c "
import smtplib
s = smtplib.SMTP('smtp.qq.com', 587)
s.starttls()
s.login('your-email@qq.com', 'your-auth-code')
print('Login OK')
"
PDF conversion fails
# Install dependencies
pip install markdown weasyprintFor Linux (Ubuntu/Debian)
sudo apt-get install libpango-1.0-0 libpangoft2-1.0-0