Return nil from spam analyzers when primary headers are missing
Bug: https://github.com/happyDomain/happydeliver/issues/11
This commit is contained in:
parent
26025c96a2
commit
2fcee1b885
2 changed files with 15 additions and 0 deletions
|
|
@ -45,6 +45,14 @@ func (a *SpamAssassinAnalyzer) AnalyzeSpamAssassin(email *EmailMessage) *api.Spa
|
|||
return nil
|
||||
}
|
||||
|
||||
// Require at least X-Spam-Status, X-Spam-Score, or X-Spam-Flag to produce a meaningful report
|
||||
_, hasStatus := headers["X-Spam-Status"]
|
||||
_, hasScore := headers["X-Spam-Score"]
|
||||
_, hasFlag := headers["X-Spam-Flag"]
|
||||
if !hasStatus && !hasScore && !hasFlag {
|
||||
return nil
|
||||
}
|
||||
|
||||
result := &api.SpamAssassinResult{
|
||||
TestDetails: make(map[string]api.SpamTestDetail),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue