Channels
Email Channel
OpenClaw Email Channel Plugin - IMAP/SMTP two-way communication
Install
npm install
openclaw
Configuration Example
{
"env": {
"vars": {
"EMAIL_APP_PASSWORD": "your-app-password"
}
},
"channels": {
"email": {
"enabled": true,
"imap": {
"host": "imap.gmail.com",
"port": 993,
"secure": true,
"user": "[email protected]",
"password": "${EMAIL_APP_PASSWORD}"
},
"smtp": {
"host": "smtp.gmail.com",
"port": 587,
"secure": false,
"user": "[email protected]",
"password": "${EMAIL_APP_PASSWORD}"
},
"fromName": "", // optional display name
"fromAddress": "[email protected]",
"pollInterval": 30000, // ms, default 30s
"dmPolicy": "allowlist",
"allowFrom": ["[email protected]"],
"attachmentsDir": "~/.openclaw/media/email-attachments"
}
}
}
README
# ๐ง OpenClaw Email Channel Plugin
> Two-way email communication for your OpenClaw AI assistant via IMAP/SMTP.
```
๐ฅ Inbox ๐ค Reply
From: [email protected] To: [email protected]
Subject: Help with project Subject: Re: Help with project
"Can you summarize this?" "Here's the summary..."
๐ document.txt ๐ summary.txt
โ โฒ
โโโโโ OpenClaw processes via IMAP โโโโโโ
```
## โจ Features
- ๐ฅ **IMAP Monitoring** โ Real-time inbox polling with configurable intervals
- ๐ค **SMTP Delivery** โ Send replies directly from your AI assistant
- ๐งต **Thread Tracking** โ Maintains conversation context across email chains
- ๐ **Sender Allowlist** โ Control who can interact with your assistant
- ๐ **Attachments** โ Receive and send email attachments *(v0.4.0+)*
- โก **Environment Variables** โ Secure credential management via `${VAR}` syntax
---
## ๐ Installation
### Option A: Git Clone
```bash
mkdir -p ~/.openclaw/extensions
cd ~/.openclaw/extensions
git clone https://github.com/timothy-node/openclaw-email-channel.git email
cd email && npm install
openclaw gateway restart
```
### Option B: Direct URL
Install from `https://github.com/timothy-node/openclaw-email-channel` via OpenClaw extension manager.
---
## โ๏ธ Configuration
Add to your `openclaw.json`:
```jsonc
{
"env": {
"vars": {
"EMAIL_APP_PASSWORD": "your-app-password"
}
},
"channels": {
"email": {
"enabled": true,
"imap": {
"host": "imap.gmail.com",
"port": 993,
"secure": true,
"user": "[email protected]",
"password": "${EMAIL_APP_PASSWORD}"
},
"smtp": {
"host": "smtp.gmail.com",
"port": 587,
"secure": false,
"user": "[email protected]",
"password": "${EMAIL_APP_PASSWORD}"
},
"fromName": "", // optional display name
"fromAddress": "[email protected]",
"pollInterval": 30000, // ms, default 30s
"dmPolicy": "allowlist",
"allowFrom": ["[email protected]"],
"attachmentsDir": "~/.openclaw/media/email-attachments"
}
}
}
```
### Key Fields
| Field | Description |
|---|---|
| `pollInterval` | IMAP polling interval in milliseconds (default: `30000`) |
| `dmPolicy` | Set to `"allowlist"` to restrict senders |
| `allowFrom` | Array of allowed sender addresses. Supports domain wildcards like `@example.com` |
| `attachmentsDir` | Directory for saving inbound attachments *(v0.4.0+)* |
| `fromName` | Display name for outbound emails (optional) |
> โ ๏ธ **Security**: The `allowFrom` array is required when `dmPolicy` is `"allowlist"`. Only emails from listed addresses will be processed.
---
## ๐ง Gmail Setup
1. Enable **Two-Step Verification** on your Google account
2. Go to [Google App Passwords](https://myaccount.google.com/apppasswords)
3. Create a new app password (name it `OpenClaw Email`)
4. Copy the 16-character password into `env.vars.EMAIL_APP_PASSWORD`
---
## ๐ Attachments *(v0.4.0+)*
### Receiving Attachments
Set `attachmentsDir` in config. Inbound attachments are saved to that directory and their file paths are appended to the message body, so the AI assistant can read and process them.
### Sending Attachments
The outbound `sendText` supports `filePath` / `media` parameters. Attachments are sent via SMTP using nodemailer.
---
## ๐ Security Best Practices
- **Use environment variables** for passwords โ never hardcode credentials
```json
"password": "${EMAIL_APP_PASSWORD}"
```
- **Strict allowlist** โ only add trusted email addresses
- **App passwords** โ use app-specific passwords, not your main account password
- **Regular rotation** โ rotate app passwords periodically
---
## ๐ ๏ธ Troubleshooting
| Problem | Solution |
|---|---|
| No emails processed | Check `allowFrom` includes the sender address |
| Connection timeout | Verify IMAP/SMTP host and port settings |
| Authentication failed | Regenerate app password; ensure 2FA is enabled |
| Emails not sending | Check SMTP settings and `fromAddress` |
| Attachments not saved | Ensure `attachmentsDir` is set and directory exists |
---
## ๐ค Community
- ๐ฌ Telegram: https://t.me/timothy_node
## ๐ License
[MIT](LICENSE)
---
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
[](https://www.typescriptlang.org/)
[](https://github.com/openclaw/openclaw)
channels
Comments
Sign in to leave a comment