feat(email): 新增 SPF/DKIM 邮件认证追踪 (#354)

新增 EmailAuthentication 统一封装 SPF/DKIM 验证结果与 Dangerous 结论。

重构邮件列表与 SMTP 收信流程,保证认证结果在插件、数据库和列表展示之间一致,并保留伪造邮件处理优先级。

扩展解析邮件 DTO 的认证字段,覆盖历史收件恢复、发送路径隔离、HookDTO 序列化及旧版插件兼容性测试。
This commit is contained in:
P家单推人 authored and GitHub committed 2026-08-13 14:24:46 +08:00
1 parent 593c3fb720
commit 430c9c6c10
6 files changed
+338 -24

No files matched your search

+3 -1
View File
@@ -3,6 +3,7 @@ package email
import (
"encoding/json"
"github.com/Jinnrry/pmail/dto"
"github.com/Jinnrry/pmail/dto/parsemail"
"github.com/Jinnrry/pmail/dto/response"
"github.com/Jinnrry/pmail/services/list"
"github.com/Jinnrry/pmail/utils/context"
@@ -84,6 +85,7 @@ func EmailList(ctx *context.Context, w http.ResponseWriter, req *http.Request) {
var tos []User
_ = json.Unmarshal([]byte(email.To), &tos)
authentication := parsemail.NewEmailAuthentication(email.SPFCheck == 1, email.DKIMCheck == 1)
lst = append(lst, &emilItem{
ID: email.Id,
@@ -93,7 +95,7 @@ func EmailList(ctx *context.Context, w http.ResponseWriter, req *http.Request) {
IsRead: email.IsRead == 1,
Sender: sender,
To: tos,
Dangerous: email.SPFCheck == 0 && email.DKIMCheck == 0,
Dangerous: authentication.Dangerous,
Error: email.Error.String,
})
}