imap-smtp-email by netease-youdao/lobsterai
npx skills add https://github.com/netease-youdao/lobsterai --skill imap-smtp-email通过 IMAP 协议读取、搜索和管理邮件。通过 SMTP 发送邮件。支持 Gmail、Outlook、163.com、vip.163.com、126.com、vip.126.com、188.com、vip.188.com 以及任何标准的 IMAP/SMTP 服务器。
.env 配置文件由 LobsterAI 设置(邮箱设置)自动管理。请勿要求用户创建或编辑 .env 文件——直接运行命令即可。 如果凭据错误,脚本将返回清晰的错误信息;只有在这种情况下,才应通知用户检查其邮箱设置。
.env 文件位于此技能的目录中(与此 SKILL.md 文件相同的文件夹)。脚本会通过绝对路径自动加载它,与当前工作目录无关。
在技能文件夹中创建 .env 或设置环境变量:
# IMAP 配置(接收邮件)
IMAP_HOST=imap.gmail.com # 服务器主机名
IMAP_PORT=993 # 服务器端口
IMAP_USER=your@email.com
IMAP_PASS=your_password
IMAP_TLS=true # 使用 TLS/SSL 连接
IMAP_REJECT_UNAUTHORIZED=true # 对于自签名证书,设置为 false
IMAP_MAILBOX=INBOX # 默认邮箱
# SMTP 配置(发送邮件)
SMTP_HOST=smtp.gmail.com # SMTP 服务器主机名
SMTP_PORT=587 # SMTP 端口(587 用于 STARTTLS,465 用于 SSL)
SMTP_SECURE=false # SSL 为 true(端口 465),STARTTLS 为 false(端口 587)
SMTP_USER=your@gmail.com # 您的邮箱地址
SMTP_PASS=your_password # 您的密码或应用密码
SMTP_FROM=your@gmail.com # 默认发件人邮箱(可选)
SMTP_REJECT_UNAUTHORIZED=true # 对于自签名证书,设置为 false
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 提供商 | IMAP 主机 | IMAP 端口 | SMTP 主机 | SMTP 端口 |
|---|---|---|---|---|
| 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 邮箱 | imap.qq.com | 993 | smtp.qq.com | 587 |
对于 163.com 重要提示:
检查新的/未读邮件。
node scripts/imap.js check [--limit 10] [--mailbox INBOX] [--recent 2h]
选项:
--limit <n>: 最大结果数(默认:10)--mailbox <name>: 要检查的邮箱(默认:INBOX)--recent <time>: 仅显示最近 X 时间内的邮件(例如:30m, 2h, 7d)通过 UID 获取完整的邮件内容。
node scripts/imap.js fetch <uid> [--mailbox INBOX]
下载邮件中的所有附件,或特定的附件。
node scripts/imap.js download <uid> [--mailbox INBOX] [--dir <path>] [--file <filename>]
选项:
--mailbox <name>: 邮箱(默认:INBOX)--dir <path>: 输出目录(默认:当前目录)--file <filename>: 仅下载指定的附件(默认:下载全部)使用过滤器搜索邮件。
node scripts/imap.js search [options]
选项:
--unseen 仅未读消息
--seen 仅已读消息
--from <email> 发件人地址包含
--subject <text> 主题包含
--recent <time> 最近 X 时间内的邮件(例如:30m, 2h, 7d)
--since <date> 指定日期之后(YYYY-MM-DD)
--before <date> 指定日期之前(YYYY-MM-DD)
--limit <n> 最大结果数(默认:20)
--mailbox <name> 要搜索的邮箱(默认:INBOX)
将一条或多条消息标记为已读或未读。
node scripts/imap.js mark-read <uid> [uid2 uid3...]
node scripts/imap.js mark-unread <uid> [uid2 uid3...]
列出所有可用的邮箱/文件夹。
node scripts/imap.js list-mailboxes
通过 SMTP 发送邮件。
node scripts/smtp.js send --to <email> --subject <text> [options]
必需参数:
--to <email>: 收件人(多个收件人用逗号分隔)--subject <text>: 邮件主题,或使用 --subject-file <file>可选参数:
--body <text>: 纯文本正文--html: 以 HTML 格式发送正文--body-file <file>: 从文件读取正文--html-file <file>: 从文件读取 HTML--cc <email>: 抄送收件人--bcc <email>: 密送收件人--attach <file>: 附件(用逗号分隔)--from <email>: 覆盖默认发件人示例:
# 简单的文本邮件
node scripts/smtp.js send --to recipient@example.com --subject "Hello" --body "World"
# HTML 邮件
node scripts/smtp.js send --to recipient@example.com --subject "Newsletter" --html --body "<h1>Welcome</h1>"
# 带附件的邮件
node scripts/smtp.js send --to recipient@example.com --subject "Report" --body "Please find attached" --attach report.pdf
# 多个收件人
node scripts/smtp.js send --to "a@example.com,b@example.com" --cc "c@example.com" --subject "Update" --body "Team update"
通过向自己发送测试邮件来测试 SMTP 连接。
node scripts/smtp.js test
npm install
.env 中(并添加到 .gitignore)连接超时:
认证失败:
TLS/SSL 错误:
IMAP_TLS/SMTP_SECURE 设置与服务器要求匹配IMAP_REJECT_UNAUTHORIZED=false 或 SMTP_REJECT_UNAUTHORIZED=false每周安装次数
214
仓库
GitHub 星标
4.5K
首次出现
2026年2月27日
安全审计
安装于
kimi-cli212
gemini-cli212
amp212
cline212
github-copilot212
codex212
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.
The .env configuration file is automatically managed by LobsterAI Settings (邮箱设置). Do NOT ask the user to create or edit.env — just run the commands directly. If credentials are wrong, the scripts will return a clear error message; only then should you inform the user to check their email settings.
The .env file is located in this skill's directory (same folder as this SKILL.md file). The scripts load it automatically via an absolute path, regardless of the current working directory.
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
| 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 |
Important for 163.com:
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 full email content by UID.
node scripts/imap.js fetch <uid> [--mailbox INBOX]
Download all attachments from an email, or a specific attachment.
node scripts/imap.js download <uid> [--mailbox INBOX] [--dir <path>] [--file <filename>]
Options:
--mailbox <name>: Mailbox (default: INBOX)--dir <path>: Output directory (default: current directory)--file <filename>: Download only the specified attachment (default: download all)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 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 all available mailboxes/folders.
node scripts/imap.js list-mailboxes
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 senderExamples:
# 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 SMTP connection by sending a test email to yourself.
node scripts/smtp.js test
npm install
.env (add to .gitignore)Connection timeout:
Authentication failed:
TLS/SSL errors:
IMAP_TLS/SMTP_SECURE setting to server requirementsIMAP_REJECT_UNAUTHORIZED=false or SMTP_REJECT_UNAUTHORIZED=falseWeekly Installs
214
Repository
GitHub Stars
4.5K
First Seen
Feb 27, 2026
Security Audits
Gen Agent Trust HubPassSocketWarnSnykWarn
Installed on
kimi-cli212
gemini-cli212
amp212
cline212
github-copilot212
codex212
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
144,300 周安装
| 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 |