Skip to main content

Emlex

Emlex 从任意 IMAP 邮箱中筛选目标邮件,并把附件或邮件中的下载链接保存到本地。

安装

项目要求 Python 3.10 及以上版本:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"

安装后使用 em 命令,也可以在源码目录运行 python -m cli.main。

全屏 TUI

启动邮箱与下载任务管理界面:

em ui

em ui 会打开真正的全屏终端界面:左侧管理多个下载任务,右侧配置邮箱登录和下载规则,底部显示连接与保存状态。

支持的邮箱与认证方式:

  • Gmail、Outlook / Microsoft 365、QQ、163、iCloud、Yahoo;
  • 任意自定义 IMAP 服务;
  • 密码或应用专用密码;
  • OAuth2 Access Token;
  • SSL/TLS、STARTTLS,以及仅供受信网络使用的明文 IMAP。

下载规则支持:

  • 按主题关键字、发件人和回溯天数筛选邮件;
  • 下载任意后缀的附件,如 ZIP、PDF、CSV、XLSX;
  • 从 HTML 邮件中按链接文字查找并下载任意文件类型;
  • 自定义保存目录、文件后缀和 HTTP 超时;
  • 创建任意任务标识,不再局限于支付宝和微信。

常用按键:

按键 操作
Ctrl+N 新建任务
Ctrl+S 保存任务
Ctrl+T 测试邮箱连接
Ctrl+D 删除任务(需按两次确认)
Ctrl+Q 退出

旧的提示式命令 em config email add 仍保留用于脚本兼容。

如果不希望把密码直接写入 JSON,可保存环境变量引用:

em config email add \
  --provider alipay \
  --email-type gmail \
  --username you@example.com \
  --password-env EMLEX_EMAIL_PASSWORD

然后在 ~/.flow/.env 中设置密码:

EMLEX_EMAIL_PASSWORD=your-app-password

自定义 IMAP 示例:

em config email add \
  --provider wechat \
  --email-type imap \
  --username you@example.com \
  --host imap.example.com \
  --port 993

默认配置文件为 ~/.flow/config.json。如果该文件不存在,Emlex 会自动识别旧版项目内的 config/config.json;每次覆盖保存前还会在同目录生成 config.json.bak。开发和测试时可通过 --config 指定其他路径。

下载账单

em download --provider alipay
em download --provider wechat
em download --provider bank_pdf

使用其他配置文件:

em download --provider alipay --config /path/to/config.json

TUI 保存后会自动生成完整任务配置。你也可以直接编辑 profile:

{
  "alipay": {
    "email": "gmail",
    "auth_type": "pass",
    "auth": {
      "username": "you@example.com",
      "password": "${EMLEX_EMAIL_PASSWORD}"
    },
    "download": "attachment",
    "profile": {
      "name": "alipay",
      "search_subject": "支付宝",
      "sender_email": "service@example.com",
      "file_suffix": "zip",
      "encoding": "gbk"
    }
  }
}

download 可设为 attachment(兼容旧拼写 attchment)或 link。下载文件默认保存在 ~/.flow/data/<provider>/。

测试

python -m pytest

Metadata

Release files for Emlex 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Emlex 1.2.2
File Size Uploaded Provenance Actions
emlex-1.2.2.tar.gz 25.2 kB Without provenance Details for emlex-1.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Emlex 1.2.2
File Interpreter ABI Platform Actions
emlex-1.2.2-py3-none-any.whl Python 3 none any Details for emlex-1.2.2-py3-none-any.whl

Total release size: 52.5 kB

Release files / emlex-1.2.2.tar.gz

Download URL emlex-1.2.2.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b0526047a1c7e4bfdfc19cc3df7ba6b62209935ae28181d75b0313ce87fc4743
BLAKE2b-256 checksum
How to use checksums
cdea9605d23becb85a073349daa27daa84309f5a97af0938a434075f7a827820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / emlex-1.2.2-py3-none-any.whl

Download URL emlex-1.2.2-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d92656688f7344ae82f05e4388a8d913570064abcba62588865f20404a48f45
BLAKE2b-256 checksum
How to use checksums
14f0a04fea63eb049f17f19ed5db39e43a6444584ed3dee5d2edab9a981cd161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for Emlex 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page