qq-email

Original🇨🇳 Chinese
Translated
3 scripts

IMAP email receiving and SMTP email sending for QQ Mail; the account and authorization code are read from environment variables QQ_EMAIL_ACCOUNT and QQ_EMAIL_AUTH_CODE. Use this when users need to send, receive, check, forward QQ emails or configure QQ Mail.

3installs
Added on

NPX Install

npx skill4agent add shadowcz007/skills qq-email

SKILL.md Content (Chinese)

View Translation Comparison →

When to Use

Use this skill when users need to send, receive, check, forward emails via QQ Mail or configure QQ Mail.

QQ Mail Sending and Receiving

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)

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 Mail Servers

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

Scripts

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

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
# Receive the latest 10 messages (default)
node scripts/receive.js

# Receive the latest N messages
node scripts/receive.js --limit 20

# Receive emails from the latest N days (e.g., 7, 30, 90)
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

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")

  • 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

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