Read and send email via IMAP/SMTP. Check for new/unread messages, fetch content, search mailboxes, mark as read/unread, and send emails with attachments. Works with any IMAP/SMTP server including Gmail, Outlook, 163.com, vip.163.com, 126.com, and vip.126.com.
Read and send email via IMAP/SMTP protocol.
.env file in skill directory with credentials:# IMAP Configuration (receiving email)
IMAP_HOST=imap.gmail.com
IMAP_PORT=993
[email protected]
IMAP_PASS=your_app_password
IMAP_TLS=true
IMAP_MAILBOX=INBOX
# SMTP Configuration (sending email)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
[email protected]
SMTP_PASS=your_app_password
[email protected]
cd ~/.openclaw/workspace/skills/imap-smtp-email && npm install
node scripts/imap.js check --limit 10
node scripts/imap.js check --recent 2h # Last 2 hours
node scripts/imap.js check --recent 30m # Last 30 minutes
node scripts/imap.js fetch <uid>
node scripts/imap.js search --unseen
node scripts/imap.js search --from "[email protected]"
node scripts/imap.js search --subject "important"
node scripts/imap.js mark-read <uid>
node scripts/imap.js mark-unread <uid>
# Simple text email
node scripts/smtp.js send --to [email protected] --subject "Hello" --body "World"
# HTML email
node scripts/smtp.js send --to [email protected] --subject "Newsletter" --html --body "<h1>Welcome</h1>"
# Email with attachment
node scripts/smtp.js send --to [email protected] --subject "Report" --body "Please find attached" --attach report.pdf
| Provider | IMAP Host | IMAP Port | SMTP Host | SMTP Port |
|---|---|---|---|---|
| 163.com | imap.163.com | 993 | smtp.163.com | 465 |
| vip.163.com | imap.vip.163.com | 993 | smtp.vip.163.com | 465 |
| 126.com | imap.126.com | 993 | smtp.126.com | 465 |
| Gmail | imap.gmail.com | 993 | smtp.gmail.com | 587 |
| Outlook | outlook.office365.com | 993 | smtp.office365.com | 587 |
| QQ Mail | imap.qq.com | 993 | smtp.qq.com | 587 |
Important for 163.com: Use authorization code (授权码), not account password