When to use
Use this skill when the user wants to QQ Mail send email、receive email、check email、send email on behalforconfigure QQ Mail.
QQ Mail sending and receivingFor QQ Mail: receive email via IMAP and send email via SMTP. Account and authorization codeare read only from environment variables, and are not hardcoded in code or configuration.
Credentials (environment variables)
| 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 "Settings → Account and Security → Security Settings",not the QQ login password; do not commit to the repository) |
The script will validate this; if missing, it will report an error and exit; do not check it in the terminal using echo or similar methods, to avoid leaking the authorization code.
QQ Mail server
- IMAP:
imap.qq.com, port 993 (SSL) - SMTP:
smtp.qq.com, port 465 (SSL)
Script
| Script | Purpose |
|---|---|
scripts/send.js |
Read credentials from environment variables, connect to QQ Mail SMTP using nodemailer to send email; supports recipient, subject, and body (CLI parameters). |
scripts/receive.js |
Read credentials from environment variables, connect to QQ Mail IMAP using imap + mailparser to receive email; supports "most recent N" or "most recent N days", and outputs subject, sender, date,UID, and body summary. |
scripts/get-body.js |
By UID , get the specified email'sfull body(plain text, without summary truncation). Must pass --uid(value is the UID in the received mail list). |
Sending process
Execute in the skill root directory (requires npm install):
node scripts/send.js <收件人> <主题> <正文>
If the body contains spaces, wrap it in quotes; or pass only the recipient and subject, and read the body from stdin (see script --stdin)。
Example:
node scripts/send.js "recipient@example.com" "测试主题" "邮件正文内容"
Receiving process
# 收取最近 10 条(默认)
node scripts/receive.js
# 收取最近 N 条
node scripts/receive.js --limit 20
# 收取最近 N 天的邮件(如 7、30、90)
node scripts/receive.js --days 7
Output: each email's subject, sender, date,UID(unique identifier in the inbox, used to retrieve the body by UID), and body summary (first about 200 characters), for easy viewing.
Get email body
When you need thefull bodyof an email, use get-body.js, passing the UID:
node scripts/get-body.js --uid 12345
If --uid is not passed, it will prompt and exit. The UID is bound to the inbox and may become invalid after the email is moved or deleted.
- Output: The full body is output to stdout (plain text; if the original email is HTML-only, simple tag stripping is performed before output). It can be redirected to a file or piped to other commands.
- Environment variables: Same as receiving, requires
QQ_EMAIL_ACCOUNT、QQ_EMAIL_AUTH_CODE。
Optional capabilities (corresponding to "receiving options")
- Receiving time range: via
--days 7/--days 30/--days 90use the IMAP SINCE condition. - Receive "My Folders": the current script defaults to INBOX; if a custom folder is needed, you can extend the script's
openBox(e.g.openBox('我的文件夹', ...))。
Security reminder
- The QQ Mail authorization code must be generated after enabling the IMAP/SMTP service in "Settings → Account". It is different from the QQ login password; do not confuse the two.
- Do not write the real value of
QQ_EMAIL_ACCOUNT、QQ_EMAIL_AUTH_CODEinto code or commit it to the repository; configure it only through environment variables or a local.env.