Remove checks
This commit is contained in:
parent
954a9d705e
commit
0b4d32dada
28 changed files with 1656 additions and 3846 deletions
|
|
@ -45,11 +45,6 @@ func ScoreToGrade(score int) string {
|
|||
}
|
||||
}
|
||||
|
||||
// ScoreToCheckGrade converts a percentage score to an api.CheckGrade
|
||||
func ScoreToCheckGrade(score int) api.CheckGrade {
|
||||
return api.CheckGrade(ScoreToGrade(score))
|
||||
}
|
||||
|
||||
// ScoreToReportGrade converts a percentage score to an api.ReportGrade
|
||||
func ScoreToReportGrade(score int) api.ReportGrade {
|
||||
return api.ReportGrade(ScoreToGrade(score))
|
||||
|
|
@ -62,3 +57,29 @@ type DeliverabilityScorer struct{}
|
|||
func NewDeliverabilityScorer() *DeliverabilityScorer {
|
||||
return &DeliverabilityScorer{}
|
||||
}
|
||||
|
||||
// CalculateSpamScore calculates spam score from SpamAssassin results
|
||||
// Returns a score from 0-100 where higher is better
|
||||
func (s *DeliverabilityScorer) CalculateSpamScore(result *SpamAssassinResult) int {
|
||||
if result == nil {
|
||||
return 100 // No spam scan results, assume good
|
||||
}
|
||||
|
||||
// SpamAssassin score typically ranges from -10 to +20
|
||||
// Score < 0 is very likely ham (good)
|
||||
// Score 0-5 is threshold range (configurable, usually 5.0)
|
||||
// Score > 5 is likely spam
|
||||
|
||||
score := result.Score
|
||||
|
||||
// Convert SpamAssassin score to 0-100 scale (inverted - lower SA score is better)
|
||||
if score <= 0 {
|
||||
return 100 // Perfect score for ham
|
||||
} else if score >= result.RequiredScore {
|
||||
return 0 // Failed spam test
|
||||
} else {
|
||||
// Linear scale between 0 and required threshold
|
||||
percentage := (score / result.RequiredScore) * 100
|
||||
return int(100 - percentage)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue