Skip to main content
Version: 0.16

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

model

Type: SpamClassifierModel · required

The spam classifier model to use.

learnHamFromCard

Type: Boolean · default: true

Whether to automatically learn ham messages from senders in the user's address book.

learnSpamFromRblHits

Type: UnsignedInt · default: 2 · max: 100

Number of DNSBL servers that list the sender to auto-learn as spam

learnSpamFromTraps

Type: Boolean · default: true

Train as spam messages sent to spam trap addresses

holdSamplesFor

Type: Duration · default: "180d"

Duration to hold training samples for

minHamSamples

Type: UnsignedInt · default: 100 · max: 10000 · min: 1

Minimum number of ham samples required for training

minSpamSamples

Type: UnsignedInt · default: 100 · max: 10000 · min: 1

Minimum number of spam samples required for training

reservoirCapacity

Type: UnsignedInt · default: 1024 · max: 100000 · min: 100

The capacity of the training sample reservoir

trainFrequency

Type: Duration? · default: "12h"

Frequency to train the spam classifier

learnHamFromReply

Type: Boolean · default: true

Whether to automatically learn ham messages that are replies to messages sent by the recipient.

JMAP API

The SpamClassifier singleton is available via the urn:stalwart:jmap capability.

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

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",
"featureL2Normalize": true,
"featureLogScale": true,
"parameters": {
"numFeatures": "20"
}
}
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

CLI

stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.

Fetch

stalwart-cli get spam-classifier

Update

stalwart-cli update spam-classifier --field description='Updated'

Nested types

SpamClassifierModel

Defines the model used for spam classification.

  • FtrlFh: FTRL-Proximal + Feature Hashing. Carries the fields of SpamClassifierFtrlFh.
  • FtrlCcfh: FTRL-Proximal + Cuckoo Feature Hashing. Carries the fields of SpamClassifierFtrlCcfh.
  • Disabled: Disabled. No additional fields.

SpamClassifierFtrlFh

Defines a spam classifier model using FTRL-Proximal optimization with feature hashing.

parameters

Type: FtrlParameters · default: {"numFeatures":"20"}

Hyperparameters for the FTRL-FH model

featureL2Normalize

Type: Boolean · default: true

Whether to L2-normalize feature values in the spam classifier

featureLogScale

Type: Boolean · default: true

Whether to apply sublinear scaling to feature values in the spam classifier

FtrlParameters

Hyperparameters for the FTRL-Proximal optimization algorithm.

alpha

Type: Float · default: 2 · min: 0

The alpha parameter for the FTRL-Proximal algorithm

beta

Type: Float · default: 1 · min: 0

The beta parameter for the FTRL-Proximal algorithm

numFeatures

Type: ModelSize · default: "20"

The number of parameters (2^n)

l1Ratio

Type: Float · default: 0.001 · min: 0

The L1 regularization parameter for the FTRL-Proximal algorithm

l2Ratio

Type: Float · default: 0.0001 · min: 0

The L2 regularization parameter for the FTRL-Proximal algorithm

SpamClassifierFtrlCcfh

Defines a spam classifier model using FTRL-Proximal optimization with cuckoo feature hashing.

indicatorParameters

Type: FtrlParameters · default: {"numFeatures":"18"}

Hyperparameters for the indicator features in the FTRL-CCFH model

parameters

Type: FtrlParameters · default: {"numFeatures":"20"}

Hyperparameters for the FTRL-FH model

featureL2Normalize

Type: Boolean · default: true

Whether to L2-normalize feature values in the spam classifier

featureLogScale

Type: Boolean · default: true

Whether to apply sublinear scaling to feature values in the spam classifier

Enums

ModelSize

ValueLabel
1665k
17131k
18262k
19524k
201M
212M
224M
238M
2416M
2533M
2667M
27134M
28268M