Email Skill
Gmail integration for reading, sending, and managing emails through your agent.
Capabilities
- •
list [max_results]- List recent emails- •Returns: JSON array of emails with id, subject, sender, snippet, date
- •Example:
./email.py list 10
- •
search [query]- Search emails with Gmail query syntax- •Returns: Matching emails
- •Example:
./email.py search "from:boss@company.com is:unread"
- •
read [message_id]- Read full email content- •Returns: Full email with body (text and HTML)
- •Example:
./email.py read 123abc456
- •
send [to] [subject] [body]- Send an email- •Returns: Sent message confirmation
- •Example:
./email.py send "client@example.com" "Meeting notes" "Here are the notes..."
- •
threads [thread_id]- Get all messages in a thread- •Returns: Thread with all messages
- •Example:
./email.py threads 123abc456
Setup
Requires Google OAuth credentials:
- •Go to https://console.cloud.google.com/
- •Create a project and enable Gmail API
- •Create OAuth 2.0 credentials (Desktop application)
- •Download client secrets JSON
Environment Variables
| Variable | Required | Description |
|---|---|---|
GOOGLE_CLIENT_ID | Yes | OAuth client ID |
GOOGLE_CLIENT_SECRET | Yes | OAuth client secret |
GOOGLE_REFRESH_TOKEN | Yes | OAuth refresh token (obtained via auth flow) |
Authentication
First run will prompt for OAuth authorization:
bash
./email.py auth
This will:
- •Open browser for Google authorization
- •Request Gmail permissions
- •Store refresh token in SQLite database
- •Use refresh token for subsequent calls
Storage
SQLite database at ~/.openclaw/skills/email/email.db:
- •
tokens- OAuth tokens - •
cache- Cached email metadata - •
sent- Sent email log