Handle multiple dkim authentication-results

This commit is contained in:
nemunaire 2025-10-30 10:03:46 +07:00
commit f0dbc29da4
2 changed files with 37 additions and 28 deletions

View file

@ -97,13 +97,18 @@ func (a *AuthenticationAnalyzer) calculateDKIMScore(results *api.AuthenticationR
// Expect at least one passing signature
if results.Dkim != nil && len(*results.Dkim) > 0 {
hasPass := false
hasNonPass := false
for _, dkim := range *results.Dkim {
if dkim.Result == api.AuthResultResultPass {
hasPass = true
break
} else {
hasNonPass = true
}
}
if hasPass {
if hasPass && hasNonPass {
// Could be better
return 90
} else if hasPass {
return 100
} else {
// Has DKIM signatures but none passed