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

67 lines
1.5 KiB
Markdown
Raw 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
## 背景
之前的规划中,配置结构有冗余:
- IMAP 和 SMTP 各需要独立的 username/password
- host/port 需要用户手动填写
## 讨论内容
### 简化方案
用户建议采用简化配置:
```yaml
accounts:
- name: "工作邮箱"
email: "user@163.com"
provider: "163" # 自动填充 imap/smtp
username: "user@163.com" # 统一认证
password: "xxx"
smtp_encryption: "ssl" # 可选
```
### 自动识别逻辑
1. **自动识别 Provider**: 通过邮箱后缀自动判断
- `@163.com` → 163
- `@qq.com` → QQ
- `@gmail.com` → Gmail
- `@outlook.com` / `@office365.com` → Outlook
- 其他 → custom
2. **Provider 不匹配时**: 视为 custom需手动配置 host/port
### Onboarding 流程
```
1. 输入邮箱地址
2. 自动识别 provider
3. ┌─ 已知服务商 → 显示默认配置,提示确认
└─ 自定义邮箱 → 提示手动配置 IMAP/SMTP
4. 输入密码
5. 保存配置
```
## 实现计划
| 步骤 | 文件 | 修改内容 |
|------|------|---------|
| 1 | config.go | 新增 Provider、SMTPEncryption 字段 |
| 2 | config.go | 添加 normalizeAccount() 自动填充默认值 |
| 3 | config.go | 添加 providerDefaults 映射表 |
| 4 | config.go | 修改 getAccounts() 调用 normalize |
| 5 | onboarding.go | 修改交互流程,支持自动识别和默认值 |
## 待处理
- [ ] 实现 config.go 修改
- [ ] 实现 onboarding.go 流程调整
- [ ] 测试配置读取和写入