|
@@ -2,8 +2,8 @@
|
|
|
|
|
|
|
|
## 项目概览
|
|
## 项目概览
|
|
|
这是一组自动化脚本,用来:
|
|
这是一组自动化脚本,用来:
|
|
|
-1. 通过 `imap_curator_export.py` 登录 IMAP 邮箱,筛选 Steam Curator 索要激活码的邮件,导出 `curator_requests.xlsx`;
|
|
|
|
|
-2. 再用 `bulk_send_keys.py` 读取导出的 Excel 和 `steam_key.txt` 里的激活码池,批量发送 HTML 邮件,并记录每个 key 的派发日志。
|
|
|
|
|
|
|
+1. 通过 `fetch_requests.py` 登录 IMAP 邮箱,筛选 Steam Curator 索要激活码的邮件,导出 `curator_requests.xlsx`;
|
|
|
|
|
+2. 再用 `send_keys.py` 读取导出的 Excel 和 `steam_key.txt` 里的激活码池,批量发送 HTML 邮件,并记录每个 key 的派发日志。
|
|
|
|
|
|
|
|
## 环境准备
|
|
## 环境准备
|
|
|
1. 安装 Python 3.10 或更新版本(macOS 可用 `brew install python@3.10`,Windows 直接从 python.org 下载)。
|
|
1. 安装 Python 3.10 或更新版本(macOS 可用 `brew install python@3.10`,Windows 直接从 python.org 下载)。
|
|
@@ -55,7 +55,7 @@
|
|
|
```
|
|
```
|
|
|
命令行如果只写文件名(如 `--excel curator_requests.xlsx`),脚本会自动拼接对应目录(records/templates/config)。
|
|
命令行如果只写文件名(如 `--excel curator_requests.xlsx`),脚本会自动拼接对应目录(records/templates/config)。
|
|
|
|
|
|
|
|
-## `imap_curator_export.py`
|
|
|
|
|
|
|
+## `fetch_requests.py`
|
|
|
### 作用
|
|
### 作用
|
|
|
登录 IMAP 邮箱、抓取自上次书签之后的邮件,排除回复/转发,提取 Curator 名称、邮箱、社交链接、所需 key 数等信息写入 `records/curator_requests.xlsx`。脚本会把已处理的邮箱/UID 存在 `configs/curator_state.json`,下次只扫描新的邮件。
|
|
登录 IMAP 邮箱、抓取自上次书签之后的邮件,排除回复/转发,提取 Curator 名称、邮箱、社交链接、所需 key 数等信息写入 `records/curator_requests.xlsx`。脚本会把已处理的邮箱/UID 存在 `configs/curator_state.json`,下次只扫描新的邮件。
|
|
|
|
|
|
|
@@ -66,21 +66,21 @@ IMAP/起始日期/输出路径等全部在 `configs/settings.json` 中维护(
|
|
|
### 常用命令
|
|
### 常用命令
|
|
|
```bash
|
|
```bash
|
|
|
# 1. 连通性测试(只确认能否登录,不读写状态)
|
|
# 1. 连通性测试(只确认能否登录,不读写状态)
|
|
|
-python imap_curator_export.py --config configs/settings.json --test
|
|
|
|
|
|
|
+python fetch_requests.py --config configs/settings.json --test
|
|
|
|
|
|
|
|
# 2. 正式导出(使用/更新书签)
|
|
# 2. 正式导出(使用/更新书签)
|
|
|
-python imap_curator_export.py --config configs/settings.json
|
|
|
|
|
|
|
+python fetch_requests.py --config configs/settings.json
|
|
|
|
|
|
|
|
# 3. 重置书签后再导出(强制从 START_DATE 开始)
|
|
# 3. 重置书签后再导出(强制从 START_DATE 开始)
|
|
|
-python imap_curator_export.py --config configs/settings.json --reset-state
|
|
|
|
|
|
|
+python fetch_requests.py --config configs/settings.json --reset-state
|
|
|
|
|
|
|
|
# 4. 导出后顺便把匹配的邮件标记为已读
|
|
# 4. 导出后顺便把匹配的邮件标记为已读
|
|
|
-python imap_curator_export.py --config configs/settings.json --mark-read
|
|
|
|
|
|
|
+python fetch_requests.py --config configs/settings.json --mark-read
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
运行完成后会在 `records/curator_requests.xlsx` 中追加 `curtor_YYYYMMDD##` 的表格,`configs/curator_state.json` 记录最新 `last_uid`。脚本结束时,还会贴心打印三条推荐命令(Dry-run / Test / Real)。
|
|
运行完成后会在 `records/curator_requests.xlsx` 中追加 `curtor_YYYYMMDD##` 的表格,`configs/curator_state.json` 记录最新 `last_uid`。脚本结束时,还会贴心打印三条推荐命令(Dry-run / Test / Real)。
|
|
|
|
|
|
|
|
-## `bulk_send_keys.py`
|
|
|
|
|
|
|
+## `send_keys.py`
|
|
|
### 作用
|
|
### 作用
|
|
|
读取 `records/curator_requests.xlsx` 与 `records/steam_key.txt` 中待分发的激活码,按请求数量配给 key,使用 `templates/email_template.html`(若不存在则用脚本内置模板)渲染 HTML 邮件,通过 SMTP 发送,并在 `records/send_log.xlsx` 里记录“每个 key 一行”的详细日志(每次运行会新增 `sendlog_YYYYMMDD##` 的 sheet 并置顶;真实发送开始前会自动清理旧的 DRYRUN/TEST sheet)。脚本还会在 `configs/curator_state.json` 里维护 `sent_emails` 列表,防止向已发过 key 的邮箱重复派发。支持 Dry-run、Test 模式、跳过已处理 UID、发送成功后把原邮件标记 `\Answered`。如果 Excel 中包含 `Original Message-ID`,回复邮件会自动带上 `In-Reply-To/References`,方便邮件客户端按对话展示。
|
|
读取 `records/curator_requests.xlsx` 与 `records/steam_key.txt` 中待分发的激活码,按请求数量配给 key,使用 `templates/email_template.html`(若不存在则用脚本内置模板)渲染 HTML 邮件,通过 SMTP 发送,并在 `records/send_log.xlsx` 里记录“每个 key 一行”的详细日志(每次运行会新增 `sendlog_YYYYMMDD##` 的 sheet 并置顶;真实发送开始前会自动清理旧的 DRYRUN/TEST sheet)。脚本还会在 `configs/curator_state.json` 里维护 `sent_emails` 列表,防止向已发过 key 的邮箱重复派发。支持 Dry-run、Test 模式、跳过已处理 UID、发送成功后把原邮件标记 `\Answered`。如果 Excel 中包含 `Original Message-ID`,回复邮件会自动带上 `In-Reply-To/References`,方便邮件客户端按对话展示。
|
|
|
|
|
|
|
@@ -98,18 +98,18 @@ python imap_curator_export.py --config configs/settings.json --mark-read
|
|
|
### 示例
|
|
### 示例
|
|
|
```bash
|
|
```bash
|
|
|
# 1. 预览模式:只渲染邮件,不发送、不消耗 key
|
|
# 1. 预览模式:只渲染邮件,不发送、不消耗 key
|
|
|
-python bulk_send_keys.py --config configs/settings.json \
|
|
|
|
|
|
|
+python send_keys.py --config configs/settings.json \
|
|
|
--sheet curtor_2025111907 \
|
|
--sheet curtor_2025111907 \
|
|
|
--dry-run --limit 5
|
|
--dry-run --limit 5
|
|
|
|
|
|
|
|
# 2. 测试发送:发给指定测试邮箱,记录日志但不扣除 key
|
|
# 2. 测试发送:发给指定测试邮箱,记录日志但不扣除 key
|
|
|
-python bulk_send_keys.py --config configs/settings.json \
|
|
|
|
|
|
|
+python send_keys.py --config configs/settings.json \
|
|
|
--sheet curtor_2025111907 \
|
|
--sheet curtor_2025111907 \
|
|
|
--test --test-email your_test@example.com \
|
|
--test --test-email your_test@example.com \
|
|
|
--no-consume --no-sentemail
|
|
--no-consume --no-sentemail
|
|
|
|
|
|
|
|
# 3. 正式批量发送,并把成功邮件标记 \Answered
|
|
# 3. 正式批量发送,并把成功邮件标记 \Answered
|
|
|
-python bulk_send_keys.py --config configs/settings.json \
|
|
|
|
|
|
|
+python send_keys.py --config configs/settings.json \
|
|
|
--sheet curtor_2025111907 \
|
|
--sheet curtor_2025111907 \
|
|
|
--mark-answered
|
|
--mark-answered
|
|
|
```
|
|
```
|