一阶段ok

This commit is contained in:
2026-06-01 18:59:55 +08:00
commit 9e50d05e71
52 changed files with 6155 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# 2026-06-01 MailGo 项目开发完成
## 完成内容
- 完整Go邮件系统 MailGo 开发,通过2轮QA验证
- 核心组件: SMTP(go-smtp) + IMAP(go-imap v1) + POP3(手写TCP) + Web(Gin)
- Web功能: 登录认证、收件箱、草稿箱、发件箱、撰写邮件(含附件)、设置(修改密码)、管理后台(域名/用户/DNS提示)
- 模板架构从base继承模式经3轮迭代重构为自包含+子模板模式
- 默认管理员: admin@example.com / admin
- Windows测试路径: ./win/etc/mail_go + ./win/srv/mail_go
## QA结果
- Round 1: 12/15 通过,3项失败(/drafts和/settings路由缺失,/admin路径误测)
- Round 2: 12/12 全部通过,修复后回归验证完成
## 关键修复
- SMTP ListenAndServeTLS 签名问题 → 创建独立TLS Server实例
- IMAP v2 beta API不稳定 → 切换v1
- 模板 {{template .VarName .}} 不支持 → 重构为自包含模式
- 补充 /drafts、/settings 路由及密码修改功能
+24
View File
@@ -0,0 +1,24 @@
# MailGo 项目记忆
## 技术栈
- Go + Gin + html/template + GORM + SQLite(default)/MySQL
- SMTP: github.com/emersion/go-smtp
- IMAP: github.com/emersion/go-imap v1 (NOT v2 beta)
- POP3: 手写TCP协议实现
- 配置: TOML (github.com/BurntSushi/toml)
- 会话: github.com/gin-contrib/sessions (cookie store)
- 密码: golang.org/x/crypto/bcrypt
## 关键架构决策
- 模板采用自包含+子模板模式(Go html/template不支持变量模板名)
- 每个模板是完整HTML文档,通过 {{template "styles" .}} 和 {{template "navbar" .}} 引入公共部分
- Handler调用 c.HTML(200, "define_name", data)define_name 对应模板名
- SMTP TLS: 创建独立Server实例设置 TLSConfig
- Windows路径回退: ./win/etc/mail_go 和 ./win/srv/mail_go
- 默认管理员: admin@example.com / admin
## 已知坑
- go-imap v2 是betaAPI不稳定,必须用v1
- Go filepath.Glob 不支持 ** 递归匹配,模板分两轮加载
- SMTP ListenAndServeTLS() 不接受参数,TLS需通过 TLSConfig 设置
- User模型密码字段为 PasswordHash,数据库列为 password_hash