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