Skip to main content

腾讯企业邮箱 IMAP 命令行客户端

Project description

qqmail-cli

腾讯企业邮箱 IMAP 命令行客户端,用于浏览邮件、查看正文、下载附件。所有输出均为 JSON 格式。

核心亮点

  • JSON 输出 — 所有命令输出结构化 JSON,默认格式化,--compact 紧凑输出
  • 零配置登录 — .env 文件管理账号密码,一条命令验证连通性
  • 中文文件夹名自动解码 — Modified UTF-7 编码的文件夹名自动解码
  • 纯标准库 IMAP 通信 — 不依赖第三方 IMAP 库

安装

依赖 uv 管理 Python 环境和依赖:

uv sync

安装后可直接使用 qqmail 命令:

qqmail login

也可通过 uv run main.py 执行。

配置

在项目根目录创建 .env 文件:

IMAP_HOST=imap.exmail.qq.com
IMAP_PORT=993
IMAP_USER=your_email@example.com
IMAP_PASSWORD=your_password_or_app_token

使用方法

所有命令默认输出格式化 JSON,加 --compact 输出紧凑 JSON。

验证登录

qqmail login

列举邮箱文件夹

qqmail folders

浏览邮件(分页)

# 查看 INBOX 第一页(默认每页 20 封)
qqmail mails

# 指定文件夹和页码
qqmail mails --folder "Sent Messages" --page 2

# 调整每页数量
qqmail mails --size 50

搜索邮件

--since 为必填参数。--from--subject 为可选过滤条件。

# 搜索指定日期以来的邮件
qqmail mails search --since 2026-04-13

# 按发件人过滤
qqmail mails search --since 2026-04-13 --from sender@example.com

# 按主题关键词过滤
qqmail mails search --since 2026-04-13 --subject 周报

# 组合过滤 + 限制数量
qqmail mails search --since 2026-04-13 --before 2026-04-20 \
  --from sender@example.com --subject 周报 --limit 5

查看邮件详情

qqmail mail 1555

# 查看完整内容(含转发的历史邮件)
qqmail mail 1555 --raw

# 指定文件夹
qqmail mail 1555 --folder "Sent Messages"

输出包含:idfromtoccsubjectdatebodyattachments

操作附件

# 列出附件
qqmail attachments list 1555

# 下载全部附件
qqmail attachments download 1555 -o /tmp/attachments

# 只下载指定附件
qqmail attachments download 1555 -f "周报.xlsx" -o /tmp/attachments

命令速查

命令 说明
login 验证登录信息
folders 列举邮箱文件夹
mails 浏览邮件(--folder--page--size
mails search 搜索邮件(--since 必填,--from/--subject 可选)
mail <id> 获取邮件详情(--raw 含历史邮件)
attachments list <id> 列出邮件附件
attachments download <id> 下载附件(-f 指定单个,-o 目录)

全局选项:--compact 紧凑 JSON 输出。

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qqmail_cli-0.3.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qqmail_cli-0.3.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file qqmail_cli-0.3.0.tar.gz.

File metadata

  • Download URL: qqmail_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qqmail_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b21507cb077c88bd56be5f38b5c22b852259467f9e40a4b3c713010e3280f30c
MD5 e25a4adc0a883d1666894103fe88b4c8
BLAKE2b-256 195d3f07e7552c73eb1c61324c3a9c99a8429b33b5ad331dcd7456d1b3168df1

See more details on using hashes here.

Provenance

The following attestation bundles were made for qqmail_cli-0.3.0.tar.gz:

Publisher: release.yml on hualet/qqmail-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qqmail_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: qqmail_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qqmail_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ac24e88c340020ccd188e6684cc7d8db9a910bc3227056e24f1f9175f8e1a54
MD5 dd830df6345143e3028412523b813512
BLAKE2b-256 309a25bc66862954adb6a9b238c4b6c7769972fe95be04cce37b9cfa0114de4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for qqmail_cli-0.3.0-py3-none-any.whl:

Publisher: release.yml on hualet/qqmail-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page