1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-08-13 20:04:49 +02:00

Feature: Add optional SpamAssassin integration to display scores (#233)

This commit is contained in:
Ralph Slooten
2024-01-20 12:05:56 +13:00
parent 9a63567b0c
commit 9cda71f21a
15 changed files with 1013 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/axllent/mailpit/internal/auth"
"github.com/axllent/mailpit/internal/logger"
"github.com/axllent/mailpit/internal/spamassassin"
"github.com/axllent/mailpit/internal/tools"
"gopkg.in/yaml.v3"
)
@@ -106,6 +107,9 @@ var (
// Use with extreme caution!
SMTPRelayAllIncoming = false
// EnableSpamAssassin must be either <host>:<port> or "postmark"
EnableSpamAssassin string
// WebhookURL for calling
WebhookURL string
@@ -245,6 +249,16 @@ func VerifyConfig() error {
return fmt.Errorf("Webhook URL does not appear to be a valid URL (%s)", WebhookURL)
}
if EnableSpamAssassin != "" {
spamassassin.SetService(EnableSpamAssassin)
logger.Log().Infof("[spamassassin] enabled via %s", EnableSpamAssassin)
if err := spamassassin.Ping(); err != nil {
logger.Log().Warnf("[spamassassin] ping: %s", err.Error())
} else {
}
}
SMTPTags = []AutoTag{}
if SMTPCLITags != "" {