Files
mail/doc/001-feature-planning.md
Z.To 7ab9f00c4f Fearure:
- 增加收件箱功能(有BUG)
- 增加已发送|草稿箱|发送历史 本地记录
2026-04-09 21:48:21 +08:00

99 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Pop 功能规划讨论
**日期**: 2026-04-09
## 需求概述
增加两个核心功能:
1. **发送历史记录** - 使用 SQLite 存储已发送/失败的邮件
2. **邮件接收功能** - 通过 IMAP 获取收件箱中未读邮件
## 详细设计
### 1. 发送历史记录
- 使用 SQLite (`history.db`) 存储
- 字段发件人、收件人、CC、BCC、主题、正文(纯文本/HTML)、附件、状态(已发送/草稿)、发送时间、交付方式
- 发送成功 → 标记 "sent",发送失败 → 标记 "draft"
### 2. 邮件接收功能
- 使用 IMAP 协议连接邮箱
- 仅获取 **7天内未读** 的邮件
- 不下载完整内容到本地,每次从 IMAP 拉取最新数据(轻量版)
- 支持多账户,合并展示
### 3. 收件箱看板 (Inbox UI)
- 新命令: `pop inbox`
- 使用 `bubbles/list` 组件
- 显示格式: `<来源> · <发件人> - <主题> <时间>`
- 支持搜索/过滤 (输入 "163" 可过滤来源)
### 4. 配置扩展
```yaml
accounts:
- name: "工作邮箱"
email: "user@163.com"
imap:
host: "imap.163.com"
port: 993
username: "user@163.com"
password: "xxx"
smtp:
host: "smtp.163.com"
port: 465
username: "user@163.com"
password: "xxx"
encryption: "ssl"
# 兼容原有单账户配置
from: "user@163.com"
smtp:
host: "smtp.163.com"
...
```
## 常见邮箱 IMAP 配置
| 运营商 | IMAP Host | Port |
|--------|-----------|------|
| 163 | imap.163.com | 993 |
| QQ | imap.qq.com | 993 |
| Gmail | imap.gmail.com | 993 |
| Outlook | outlook.office365.com | 993 |
## 文件变更计划
### 新增文件
- `history.go` - SQLite 操作
- `imap.go` - IMAP 接收
- `inbox.go` - 收件箱 TUI 入口
- `inbox/model.go` - 收件箱 Model
### 修改文件
- `config.go` - 支持多账户
- `email.go` - 发送后记录历史
- `main.go` - 新增 inbox/history 子命令
### 新增依赖
- `github.com/mattn/go-sqlite3`
- `github.com/mattn/go-imap`
## 命令行接口
```bash
pop inbox # 打开收件箱
pop history # 查看发送历史
pop history --draft # 只看草稿
```
## 待定问题
- [x] 发送历史存储哪些信息 - 完整信息
- [x] 收件箱针对所有账户还是单一账户 - 合并收件箱
- [x] 新功能是否修改现有 TUI - 独立命令
- [x] 搜索功能 - 使用 list 组件内置 Filter
- [x] 来源标识 - `<来源> · <主题>` 格式
- [x] 是否本地存储已接收邮件 - 轻量版,不存储