Skip to content

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

Type: SpamClassifierModel · required

The spam classifier model to use.

Type: Boolean · default: true

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

Type: UnsignedInt · default: 2 · max: 100

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

Type: Boolean · default: true

Train as spam messages sent to spam trap addresses

Type: Duration · default: "180d"

Duration to hold training samples for

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

Minimum number of ham samples required for training

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

Minimum number of spam samples required for training

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

The capacity of the training sample reservoir

Type: Duration? · default: "12h"

Frequency to train the spam classifier

Type: Boolean · default: true

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

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

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.

Terminal window
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"
]
}'

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.

Terminal window
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.

Terminal window
stalwart-cli get SpamClassifier
Terminal window
stalwart-cli update SpamClassifier --field model='{"@type":"FtrlFh"}'

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.

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

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

Hyperparameters for the FTRL-FH model

Type: Boolean · default: true

Whether to L2-normalize feature values in the spam classifier

Type: Boolean · default: true

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

Hyperparameters for the FTRL-Proximal optimization algorithm.

Type: Float · default: 2 · min: 0

The alpha parameter for the FTRL-Proximal algorithm

Type: Float · default: 1 · min: 0

The beta parameter for the FTRL-Proximal algorithm

Type: ModelSize · default: "20"

The number of parameters (2^n)

Type: Float · default: 0.001 · min: 0

The L1 regularization parameter for the FTRL-Proximal algorithm

Type: Float · default: 0.0001 · min: 0

The L2 regularization parameter for the FTRL-Proximal algorithm

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

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

Hyperparameters for the indicator features in the FTRL-CCFH model

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

Hyperparameters for the FTRL-FH model

Type: Boolean · default: true

Whether to L2-normalize feature values in the spam classifier

Type: Boolean · default: true

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

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