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_ACCOUNTQQ 邮箱账号(完整地址,如 xxx@qq.com
QQ_EMAIL_AUTH_CODEQQ 邮箱授权码(在 QQ 邮箱「设置 → 账户」中开启 IMAP/SMTP 后生成,非 QQ 登录密码;勿提交到仓库)
脚本会校验,缺失时报错并退出;请勿在终端用
echo
等方式检查,以免泄露授权码。
VariableDescription
QQ_EMAIL_ACCOUNTQQ Mail account (full address, e.g., xxx@qq.com)
QQ_EMAIL_AUTH_CODEQQ 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
echo
in the terminal to check them to avoid leaking the authorization code.

QQ 邮箱服务器

QQ Mail Servers

  • IMAP
    imap.qq.com
    ,端口 993(SSL)
  • SMTP
    smtp.qq.com
    ,端口 465(SSL)
  • IMAP:
    imap.qq.com
    , port 993 (SSL)
  • SMTP:
    smtp.qq.com
    , port 465 (SSL)

脚本

Scripts

脚本作用
scripts/send.js
从环境变量读凭证,用 nodemailer 连接 QQ 邮箱 SMTP 发信;支持收件人、主题、正文(CLI 参数)。
scripts/receive.js
从环境变量读凭证,用 imap + mailparser 连接 QQ 邮箱 IMAP 收信;支持「最近 N 条」或「最近 N 天」,输出主题、发件人、日期、UID、正文摘要。
scripts/get-body.js
UID 获取指定邮件的完整正文(纯文本,无摘要截断)。必须传入
--uid
(值为收信列表中的 UID)。
ScriptFunction
scripts/send.js
Reads credentials from environment variables, uses nodemailer to connect to QQ Mail SMTP to send emails; supports recipient, subject, and body (CLI parameters).
scripts/receive.js
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.
scripts/get-body.js
Retrieves the full body of a specified email (plain text, no summary truncation) by UID. Must pass the
--uid
parameter (value is the UID from the received email list).

发信流程

Sending Emails

在 skill 根目录下执行(需已
npm install
):
bash
node scripts/send.js <收件人> <主题> <正文>
正文若含空格,请用引号包裹;或只传收件人和主题,正文从 stdin 读入(见脚本
--stdin
)。
示例
bash
node scripts/send.js "recipient@example.com" "测试主题" "邮件正文内容"
Execute in the skill root directory (after running
npm install
):
bash
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
--stdin
option).
Example:
bash
node scripts/send.js "recipient@example.com" "Test Subject" "Email body content"

收信流程

Receiving Emails

bash
undefined
bash
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

需要某封邮件的完整正文时,使用
get-body.js
,传入收信列表中该邮件的 UID
bash
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
get-body.js
and pass the UID of the email from the received list:
bash
node scripts/get-body.js --uid 12345
The script will prompt and exit if
--uid
is not provided. UID is bound to the inbox and may become invalid if the email is moved or deleted.
  • 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
    QQ_EMAIL_ACCOUNT
    and
    QQ_EMAIL_AUTH_CODE
    .

可选能力(与「收取选项」对应)

Optional Capabilities (Corresponding to "Receiving Options")

  • 收取时间范围:通过
    --days 7
    /
    --days 30
    /
    --days 90
    使用 IMAP SINCE 条件。
  • 收取「我的文件夹」:当前脚本默认 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
    openBox
    function in the script (e.g.,
    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
    QQ_EMAIL_ACCOUNT
    and
    QQ_EMAIL_AUTH_CODE
    into code or commit them to repositories; only configure them via environment variables or local
    .env
    files.