qq-email
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese何时使用
When to Use
用户要使用 QQ 邮箱 发邮件、收邮件、查邮件、代发邮件或配置 QQ 邮箱时使用本 skill。
Use this skill when users need to send, receive, check, forward emails via QQ Mail or configure QQ Mail.
QQ 邮箱收发
QQ Mail Sending and Receiving
面向 QQ 邮箱:通过 IMAP 收取邮件、SMTP 发送邮件。账号与授权码仅从环境变量读取,不在代码或配置中硬编码。
For QQ Mail: Receive emails via IMAP and send emails via SMTP. The account and authorization code are only read from environment variables and not hard-coded in code or configurations.
凭证(环境变量)
Credentials (Environment Variables)
| 变量 | 说明 |
|---|---|
| QQ_EMAIL_ACCOUNT | QQ 邮箱账号(完整地址,如 xxx@qq.com) |
| QQ_EMAIL_AUTH_CODE | QQ 邮箱授权码(在 QQ 邮箱「设置 → 账户」中开启 IMAP/SMTP 后生成,非 QQ 登录密码;勿提交到仓库) |
脚本会校验,缺失时报错并退出;请勿在终端用 等方式检查,以免泄露授权码。
echo| Variable | Description |
|---|---|
| QQ_EMAIL_ACCOUNT | QQ Mail account (full address, e.g., xxx@qq.com) |
| QQ_EMAIL_AUTH_CODE | QQ Mail authorization code (generated after enabling IMAP/SMTP in QQ Mail's "Settings → Accounts"; not the QQ login password; do not commit to repositories) |
The script will perform validation and exit with an error if any credential is missing; do not use commands like in the terminal to check them to avoid leaking the authorization code.
echoQQ 邮箱服务器
QQ Mail Servers
- IMAP:,端口 993(SSL)
imap.qq.com - SMTP:,端口 465(SSL)
smtp.qq.com
- IMAP: , port 993 (SSL)
imap.qq.com - SMTP: , port 465 (SSL)
smtp.qq.com
脚本
Scripts
| 脚本 | 作用 |
|---|---|
| 从环境变量读凭证,用 nodemailer 连接 QQ 邮箱 SMTP 发信;支持收件人、主题、正文(CLI 参数)。 |
| 从环境变量读凭证,用 imap + mailparser 连接 QQ 邮箱 IMAP 收信;支持「最近 N 条」或「最近 N 天」,输出主题、发件人、日期、UID、正文摘要。 |
| 按 UID 获取指定邮件的完整正文(纯文本,无摘要截断)。必须传入 |
| Script | Function |
|---|---|
| Reads credentials from environment variables, uses nodemailer to connect to QQ Mail SMTP to send emails; supports recipient, subject, and body (CLI parameters). |
| Reads credentials from environment variables, uses imap + mailparser to connect to QQ Mail IMAP to receive emails; supports "latest N messages" or "latest N days", outputs subject, sender, date, UID, and body summary. |
| Retrieves the full body of a specified email (plain text, no summary truncation) by UID. Must pass the |
发信流程
Sending Emails
在 skill 根目录下执行(需已 ):
npm installbash
node scripts/send.js <收件人> <主题> <正文>正文若含空格,请用引号包裹;或只传收件人和主题,正文从 stdin 读入(见脚本 )。
--stdin示例:
bash
node scripts/send.js "recipient@example.com" "测试主题" "邮件正文内容"Execute in the skill root directory (after running ):
npm installbash
node scripts/send.js <recipient> <subject> <body>If the body contains spaces, wrap it in quotes; or only pass the recipient and subject, and read the body from stdin (see the script's option).
--stdinExample:
bash
node scripts/send.js "recipient@example.com" "Test Subject" "Email body content"收信流程
Receiving Emails
bash
undefinedbash
undefined收取最近 10 条(默认)
Receive the latest 10 messages (default)
node scripts/receive.js
node scripts/receive.js
收取最近 N 条
Receive the latest N messages
node scripts/receive.js --limit 20
node scripts/receive.js --limit 20
收取最近 N 天的邮件(如 7、30、90)
Receive emails from the latest N days (e.g., 7, 30, 90)
node scripts/receive.js --days 7
输出:每封邮件的主题、发件人、日期、**UID**(收件箱内唯一标识,用于按 UID 取正文)、正文摘要(前约 200 字),便于查看。node scripts/receive.js --days 7
Output: For each email, displays subject, sender, date, **UID** (unique identifier in the inbox, used to retrieve the body by UID), and body summary (first ~200 characters) for easy viewing.获取邮件正文
Retrieving Email Body
需要某封邮件的完整正文时,使用 ,传入收信列表中该邮件的 UID:
get-body.jsbash
node scripts/get-body.js --uid 12345未传 时会提示并退出。UID 与收件箱绑定,邮件移动或删除后可能失效。
--uid- 输出:完整正文输出到 stdout(纯文本;若原邮件仅有 HTML,会做简单去标签后输出)。可重定向到文件或管道给其它命令。
- 环境变量:与收信相同,需 、
QQ_EMAIL_ACCOUNT。QQ_EMAIL_AUTH_CODE
To get the full body of an email, use and pass the UID of the email from the received list:
get-body.jsbash
node scripts/get-body.js --uid 12345The script will prompt and exit if is not provided. UID is bound to the inbox and may become invalid if the email is moved or deleted.
--uid- Output: The full body is output to stdout (plain text; if the original email only has HTML, it will be output after simple tag removal). It can be redirected to a file or piped to other commands.
- Environment Variables: Same as receiving emails, requires and
QQ_EMAIL_ACCOUNT.QQ_EMAIL_AUTH_CODE
可选能力(与「收取选项」对应)
Optional Capabilities (Corresponding to "Receiving Options")
- 收取时间范围:通过 /
--days 7/--days 30使用 IMAP SINCE 条件。--days 90 - 收取「我的文件夹」:当前脚本默认 INBOX;若需自定义文件夹,可扩展脚本中的 (如
openBox)。openBox('我的文件夹', ...)
- Receiving Time Range: Use the IMAP SINCE condition via /
--days 7/--days 30.--days 90 - Receiving from "My Folders": The current script defaults to INBOX; to customize the folder, extend the function in the script (e.g.,
openBox).openBox('My Folder', ...)
安全提醒
Security Reminders
- QQ 邮箱授权码需在「设置 → 账户」中开启 IMAP/SMTP 服务后生成,与 QQ 登录密码不同,不要混淆。
- 不要将 、
QQ_EMAIL_ACCOUNT的真实值写入代码或提交到仓库;仅通过环境变量或本地QQ_EMAIL_AUTH_CODE配置。.env
- The QQ Mail authorization code must be generated after enabling the IMAP/SMTP service in "Settings → Accounts"; it is different from the QQ login password, so do not confuse them.
- Do not write the actual values of and
QQ_EMAIL_ACCOUNTinto code or commit them to repositories; only configure them via environment variables or localQQ_EMAIL_AUTH_CODEfiles..env