360 Secure SkillHub
360 安全技能中心

QQ Mail

使用 Python 标准库脚本连接 QQ 邮箱 IMAP/SMTP 服务器,凭据取自 QQMAIL_USER 与 QQMAIL_AUTH_CODE 环境变量;支持读取收件箱、按索引读信、按主题/发件人/日期搜索、列出邮件文件夹,以及发送纯文本或带附件的邮件,并对正文做字符集解码以正确显示中文。

pdpaer
pdpaer
热度 90.83
最近更新 2026-05-17 12:01:50
分类:协作依赖:代码执行 / 第三方 API / 读写文件应用场景:邮件起草

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add qqmail
Metadata
name
qqmail
description
Manage QQ Mail (QQ邮箱) via IMAP/SMTP. Use when the user wants to read, send, search, or manage emails from their QQ mailbox. Supports reading inbox, sending emails with attachments, searching by subject/sender/date, and listing folders.
metadata
{"openclaw":{"requires":{"bins":["python3"]},"os":["win32","linux","darwin"],"primaryEnv":"QQMAIL_AUTH_CODE"}}

QQ Mail Manager

Manage QQ邮箱 via standard IMAP/SMTP protocols using Python scripts.

Prerequisites

The user must enable IMAP/SMTP in QQ Mail settings and obtain an authorization code (授权码):

  1. Log in to mail.qq.com → Settings (设置) → Account (账户)
  2. Enable IMAP/SMTP service
  3. Generate an authorization code (授权码) — this is NOT the QQ password

Configuration

The skill reads credentials from environment variables:

  • QQMAIL_USER — QQ email address (e.g. 123456789@qq.com)
  • QQMAIL_AUTH_CODE — Authorization code from QQ Mail settings (授权码)

Available Operations

Read recent emails

python3 {baseDir}/scripts/qqmail.py inbox --limit 10

Shows: sender, subject, date, and a text preview of each email.

Read a specific email by index

python3 {baseDir}/scripts/qqmail.py read --index 1

Shows the full email content (text body).

Send an email

python3 {baseDir}/scripts/qqmail.py send --to "recipient@example.com" --subject "Hello" --body "Email content here"

Send with attachment

python3 {baseDir}/scripts/qqmail.py send --to "recipient@example.com" --subject "Report" --body "See attached" --attachment "/path/to/file.pdf"

Search emails

python3 {baseDir}/scripts/qqmail.py search --subject "keyword"
python3 {baseDir}/scripts/qqmail.py search --from "sender@example.com"
python3 {baseDir}/scripts/qqmail.py search --since "2026-01-01"
python3 {baseDir}/scripts/qqmail.py search --subject "meeting" --since "2026-02-01" --limit 5

List mail folders

python3 {baseDir}/scripts/qqmail.py folders

Read from a specific folder

python3 {baseDir}/scripts/qqmail.py inbox --folder "Sent Messages" --limit 5

Error Handling

  • If authentication fails: verify QQMAIL_USER and QQMAIL_AUTH_CODE are set correctly.
  • If IMAP is not enabled: guide the user to enable it in QQ Mail settings.
  • Connection errors may indicate network issues or proxy requirements.

Notes

  • QQ Mail IMAP server: imap.qq.com:993 (SSL)
  • QQ Mail SMTP server: smtp.qq.com:465 (SSL)
  • All scripts use Python 3 standard library only (no pip install needed).
  • Email content is decoded with charset detection for proper Chinese display.