微算力 · API 导航与自营网关
API 接入 EN
未登录登录
✨

imap-smtp-email

imap-smtp-email · v0.0.4
安全 A 级 作者 gzlicanyi 公开目录收录
41.7k 下载 97 安装 140.9k 收藏 14 浏览

简介

imap-smtp-email

原始描述

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. Sup...

通过你的 Agent 添加

安装目录:imap-smtp-email/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/imap-smtp-email/
Codex CLI~/.codex/skills/imap-smtp-email/
DeepSeek Harness~/.agents/skills/imap-smtp-email/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

imap-smtp-email 是一个基于 Node.js 的标准邮件协议客户端工具,完整实现 IMAP 收信与 SMTP 发信功能。用户通过环境变量配置邮件服务器凭证后,即可通过命令行完成邮件检查、搜索、内容获取、附件下载、标记已读/未读、发送邮件等全生命周期管理。

收信端(IMAP):支持检查新邮件、按 UID 拉取完整内容、多条件搜索(未读/发件人/主题/时间范围)、批量标记状态、列出邮箱目录、下载附件到指定路径。

发信端(SMTP):支持纯文本/HTML 邮件、多收件人/抄送/密送、多附件上传、发件人地址覆盖,内置连接测试命令。

已预置 Gmail、Outlook、163.com、126.com、188.com、yeah.net、QQ 邮箱等主流服务商的连接参数,开箱即用。


显著优点

  1. 协议标准:基于 IMAP4rev1 与 SMTP 标准协议,兼容任何合规邮件服务商,不受特定平台绑定
  2. 安全传输:默认强制 TLS/SSL 加密(IMAP 993 端口、SMTP 587/465 端口),支持证书验证开关
  3. 凭证隔离:所有敏感信息(密码、授权码)均通过环境变量注入,无硬编码风险,符合十二要素应用规范
  4. 国产适配:网易官方维护,针对 163/vip.163/126/vip.126/188/vip.188/yeah.net 系列邮箱深度优化,明确区分「授权码」与「账户密码」的使用场景
  5. 生态成熟:底层依赖 nodemailer(下载量过亿)、imap、mailparser 等业界标杆库,社区验证充分

潜在缺点与局限性

  • 功能边界:纯协议层工具,不提供邮件解析后的高级功能(如日历邀请处理、PGP 加密签名、邮件线程聚合)
  • 无内置 UI:仅限命令行交互,需配合其他 Skill 或脚本实现自动化工作流
  • 附件风险:下载附件后不会自动杀毒扫描,恶意文件依赖用户侧防护
  • 无离线缓存:每次操作均实时连接服务器,频繁操作可能触发服务商频率限制
  • 输入校验宽松:当前版本对邮箱地址格式、附件大小等参数校验较宽松,存在误输入可能

适合人群

  • 需要将邮件能力集成到自动化工作流的开发者(如定时日报邮件、告警通知)
  • 使用网易系邮箱(163/126/188)且需要标准协议接入的国内用户
  • 追求最小依赖、拒绝闭源邮件 SDK 的安全敏感型团队
  • 需要在本地环境或 CI/CD 流水线中收发测试邮件的运维工程师

常规风险

  1. 凭证泄露:环境变量若未正确配置 .gitignore 或文件权限(建议 600),可能导致敏感信息意外提交或读取
  2. 中间人攻击:若用户手动关闭 REJECT_UNAUTHORIZED 以兼容自签名证书,TLS 验证被绕过,存在中间人劫持风险
  3. 服务商封禁:频繁 IMAP 轮询或 SMTP 发送可能触发 Gmail/Outlook 等平台的速率限制或安全锁定
  4. 附件安全:邮件附件可能包含钓鱼文件或恶意宏,下载后需用户自行判断来源可信度
  5. 授权码失效:网易系邮箱授权码长期不用可能过期,需定期在网页端重新生成

技能正文


name: imap-smtp-email description: 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, vip.126.com, 188.com, and vip.188.com.

IMAP/SMTP Email Tool

Read, search, and manage email via IMAP protocol. Send email via SMTP. Supports Gmail, Outlook, 163.com, vip.163.com, 126.com, vip.126.com, 188.com, vip.188.com, and any standard IMAP/SMTP server.

Configuration

Create .env in the skill folder or set environment variables:

# IMAP Configuration (receiving email)
IMAP_HOST=imap.gmail.com          # Server hostname
IMAP_PORT=993                     # Server port
IMAP_USER=your@email.com
IMAP_PASS=your_password
IMAP_TLS=true                     # Use TLS/SSL connection
IMAP_REJECT_UNAUTHORIZED=true     # Set to false for self-signed certs
IMAP_MAILBOX=INBOX                # Default mailbox

# SMTP Configuration (sending email)
SMTP_HOST=smtp.gmail.com          # SMTP server hostname
SMTP_PORT=587                     # SMTP port (587 for STARTTLS, 465 for SSL)
SMTP_SECURE=false                 # true for SSL (465), false for STARTTLS (587)
SMTP_USER=your@gmail.com          # Your email address
SMTP_PASS=your_password           # Your password or app password
SMTP_FROM=your@gmail.com          # Default sender email (optional)
SMTP_REJECT_UNAUTHORIZED=true     # Set to false for self-signed certs

Common Email Servers

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
vip.126.com imap.vip.126.com 993 smtp.vip.126.com 465
188.com imap.188.com 993 smtp.188.com 465
vip.188.com imap.vip.188.com 993 smtp.vip.188.com 465
yeah.net imap.yeah.net 993 smtp.yeah.net 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
  • Enable IMAP/SMTP in web settings first

IMAP Commands (Receiving Email)

check

Check for new/unread emails.

node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]

Options:

  • --limit <n>: Max results (default: 10)
  • --mailbox <name>: Mailbox to check (default: INBOX)
  • --recent <time>: Only show emails from last X time (e.g., 30m, 2h, 7d)

fetch

Fetch full email content by UID.

node scripts/imap.js fetch <uid> [--mailbox INBOX]

search

Search emails with filters.

node scripts/imap.js search [options]

Options:
  --unseen           Only unread messages
  --seen             Only read messages
  --from <email>     From address contains
  --subject <text>   Subject contains
  --recent <time>    From last X time (e.g., 30m, 2h, 7d)
  --since <date>     After date (YYYY-MM-DD)
  --before <date>    Before date (YYYY-MM-DD)
  --limit <n>        Max results (default: 20)
  --mailbox <name>   Mailbox to search (default: INBOX)

mark-read / mark-unread

Mark message(s) as read or unread.

node scripts/imap.js mark-read <uid> [uid2 uid3...]
node scripts/imap.js mark-unread <uid> [uid2 uid3...]

list-mailboxes

List all available mailboxes/folders.

node scripts/imap.js list-mailboxes

SMTP Commands (Sending Email)

send

Send email via SMTP.

node scripts/smtp.js send --to <email> --subject <text> [options]

Required:

  • --to <email>: Recipient (comma-separated for multiple)
  • --subject <text>: Email subject, or --subject-file <file>

Optional:

  • --body <text>: Plain text body
  • --html: Send body as HTML
  • --body-file <file>: Read body from file
  • --html-file <file>: Read HTML from file
  • --cc <email>: CC recipients
  • --bcc <email>: BCC recipients
  • --attach <file>: Attachments (comma-separated)
  • --from <email>: Override default sender

Examples:

# Simple text email
node scripts/smtp.js send --to recipient@example.com --subject "Hello" --body "World"

# HTML email
node scripts/smtp.js send --to recipient@example.com --subject "Newsletter" --html --body "<h1>Welcome</h1>"

# Email with attachment
node scripts/smtp.js send --to recipient@example.com --subject "Report" --body "Please find attached" --attach report.pdf

# Multiple recipients
node scripts/smtp.js send --to "a@example.com,b@example.com" --cc "c@example.com" --subject "Update" --body "Team update"

test

Test SMTP connection by sending a test email to yourself.

node scripts/smtp.js test

Dependencies

npm install

Security Notes

  • Store credentials in .env (add to .gitignore)
  • For Gmail: use App Password if 2FA is enabled
  • For 163.com: use authorization code (授权码), not account password

Troubleshooting

Connection timeout:

  • Verify server is running and accessible
  • Check host/port configuration

Authentication failed:

  • Verify username (usually full email address)
  • Check password is correct
  • For 163.com: use authorization code, not account password
  • For Gmail: use App Password if 2FA enabled

TLS/SSL errors:

  • Match IMAP_TLS/SMTP_SECURE setting to server requirements
  • For self-signed certs: set IMAP_REJECT_UNAUTHORIZED=false or SMTP_REJECT_UNAUTHORIZED=false

正文来自原始仓库, 版权归作者所有,许可:MIT。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/netease-youdao/LobsterAI

标签

没有标签

同类 Skill