SpamClassifier
SpamClassifier
Section titled “SpamClassifier”Configures the spam classifier model, training parameters, and auto-learning settings.
This object can be configured from the WebUI under Settings › Spam Filter › Classifier
Fields
Section titled “Fields”Type:
SpamClassifierModel· requiredThe spam classifier model to use.
learnHamFromCard
Section titled “learnHamFromCard”Type:
Boolean· default:trueWhether to automatically learn ham messages from senders in the user’s address book.
learnSpamFromRblHits
Section titled “learnSpamFromRblHits”Type:
UnsignedInt· default:2· max: 100Number of DNSBL servers that list the sender to auto-learn as spam
learnSpamFromTraps
Section titled “learnSpamFromTraps”Type:
Boolean· default:trueTrain as spam messages sent to spam trap addresses
holdSamplesFor
Section titled “holdSamplesFor”Type:
Duration· default:"180d"Duration to hold training samples for
minHamSamples
Section titled “minHamSamples”Type:
UnsignedInt· default:100· max: 10000 · min: 1Minimum number of ham samples required for training
minSpamSamples
Section titled “minSpamSamples”Type:
UnsignedInt· default:100· max: 10000 · min: 1Minimum number of spam samples required for training
reservoirCapacity
Section titled “reservoirCapacity”Type:
UnsignedInt· default:1024· max: 100000 · min: 100The capacity of the training sample reservoir
trainFrequency
Section titled “trainFrequency”Type:
Duration?· default:"12h"Frequency to train the spam classifier
learnHamFromReply
Section titled “learnHamFromReply”Type:
Boolean· default:trueWhether to automatically learn ham messages that are replies to messages sent by the recipient.
JMAP API
Section titled “JMAP API”The SpamClassifier singleton is available via the urn:stalwart:jmap capability.
x:SpamClassifier/get
Section titled “x:SpamClassifier/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
For singletons, the ids argument should be the literal singleton (or null to return the single instance).
This method requires the sysSpamClassifierGet permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:SpamClassifier/get", { "ids": [ "singleton" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:SpamClassifier/set
Section titled “x:SpamClassifier/set”This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
For singletons, only the update argument with id singleton is accepted; create and destroy arguments are rejected.
This method requires the sysSpamClassifierUpdate permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:SpamClassifier/set", { "update": { "singleton": { "model": { "@type": "FtrlFh" } } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
stalwart-cli get SpamClassifierUpdate
Section titled “Update”stalwart-cli update SpamClassifier --field model='{"@type":"FtrlFh"}'Nested types
Section titled “Nested types”SpamClassifierModel
Section titled “SpamClassifierModel”Defines the model used for spam classification.
FtrlFh: FTRL-Proximal + Feature Hashing. Carries the fields ofSpamClassifierFtrlFh.FtrlCcfh: FTRL-Proximal + Cuckoo Feature Hashing. Carries the fields ofSpamClassifierFtrlCcfh.Disabled: Disabled. No additional fields.
SpamClassifierFtrlFh
Section titled “SpamClassifierFtrlFh”Defines a spam classifier model using FTRL-Proximal optimization with feature hashing.
parameters
Section titled “parameters”Type:
FtrlParameters· default:{"numFeatures":"20"}Hyperparameters for the FTRL-FH model
featureL2Normalize
Section titled “featureL2Normalize”Type:
Boolean· default:trueWhether to L2-normalize feature values in the spam classifier
featureLogScale
Section titled “featureLogScale”Type:
Boolean· default:trueWhether to apply sublinear scaling to feature values in the spam classifier
FtrlParameters
Section titled “FtrlParameters”Hyperparameters for the FTRL-Proximal optimization algorithm.
Type:
Float· default:2· min: 0The alpha parameter for the FTRL-Proximal algorithm
Type:
Float· default:1· min: 0The beta parameter for the FTRL-Proximal algorithm
numFeatures
Section titled “numFeatures”Type:
ModelSize· default:"20"The number of parameters (2^n)
l1Ratio
Section titled “l1Ratio”Type:
Float· default:0.001· min: 0The L1 regularization parameter for the FTRL-Proximal algorithm
l2Ratio
Section titled “l2Ratio”Type:
Float· default:0.0001· min: 0The L2 regularization parameter for the FTRL-Proximal algorithm
SpamClassifierFtrlCcfh
Section titled “SpamClassifierFtrlCcfh”Defines a spam classifier model using FTRL-Proximal optimization with cuckoo feature hashing.
indicatorParameters
Section titled “indicatorParameters”Type:
FtrlParameters· default:{"numFeatures":"18"}Hyperparameters for the indicator features in the FTRL-CCFH model
parameters
Section titled “parameters”Type:
FtrlParameters· default:{"numFeatures":"20"}Hyperparameters for the FTRL-FH model
featureL2Normalize
Section titled “featureL2Normalize”Type:
Boolean· default:trueWhether to L2-normalize feature values in the spam classifier
featureLogScale
Section titled “featureLogScale”Type:
Boolean· default:trueWhether to apply sublinear scaling to feature values in the spam classifier
ModelSize
Section titled “ModelSize”| Value | Label |
|---|---|
16 | 65k |
17 | 131k |
18 | 262k |
19 | 524k |
20 | 1M |
21 | 2M |
22 | 4M |
23 | 8M |
24 | 16M |
25 | 33M |
26 | 67M |
27 | 134M |
28 | 268M |