Skip to main content
Version: 0.16

SpamTrainingSample

Stores an email sample used for spam classifier training.

This object can be configured from the WebUI under Account › Spam Samples

Fields

from

Type: EmailAddress · read-only · server-set

Email address of the sender of the message associated with this training sample

subject

Type: String · server-set

Subject of the message associated with this training sample

blobId

Type: BlobId · read-only

Reference to the stored message content

isSpam

Type: Boolean · read-only · default: false

Indicates whether the sample is spam (true) or ham (false)

accountId

Type: Id<Account>? · read-only

Identifier of the account associated with this training sample

expiresAt

Type: UTCDateTime · server-set

Timestamp when the training sample is scheduled to expire

deleteAfterUse

Type: Boolean · read-only · default: false

Indicates whether the training sample should be deleted after being used for training

JMAP API

The SpamTrainingSample object is available via the urn:stalwart:jmap capability.

x:SpamTrainingSample/get

This is a standard Foo/get method as defined in RFC 8620, Section 5.1.

This method requires the sysSpamTrainingSampleGet permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SpamTrainingSample/get",
{
"ids": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

x:SpamTrainingSample/set

This is a standard Foo/set method as defined in RFC 8620, Section 5.3.

Supports create, update, and destroy operations in a single call.

Create

This operation requires the sysSpamTrainingSampleCreate permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SpamTrainingSample/set",
{
"create": {
"new1": {}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

Update

This operation requires the sysSpamTrainingSampleUpdate permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SpamTrainingSample/set",
{
"update": {
"id1": {
"id": "id1"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

Destroy

This operation requires the sysSpamTrainingSampleDestroy permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SpamTrainingSample/set",
{
"destroy": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

x:SpamTrainingSample/query

This is a standard Foo/query method as defined in RFC 8620, Section 5.5.

This method requires the sysSpamTrainingSampleQuery permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SpamTrainingSample/query",
{
"filter": {
"accountId": "id1"
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

The x:SpamTrainingSample/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):

ConditionKind
accountIdid of Account

CLI

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

Fetch

stalwart-cli get spam-training-sample id1

Create

stalwart-cli create spam-training-sample

Query

stalwart-cli query spam-training-sample
stalwart-cli query spam-training-sample --where accountId=id1

Update

stalwart-cli update spam-training-sample id1 --field description='Updated'

Delete

stalwart-cli delete spam-training-sample --ids id1