Skip to main content
Version: 0.16

SpamTag

Defines a score or action assigned to a spam classification tag.

This object can be configured from the WebUI under Settings › Spam Filter › Scores

Fields

SpamTag is a multi-variant object: each instance has an @type discriminator selecting one of the variants below, and each variant carries its own set of fields.

@type: "Score"

Assign Score

tag

Type: String · required

The spam tag name

score

Type: Float · default: 0 · min: -999999 · max: 999999

The score for the tag

@type: "Discard"

Discard

tag

Type: String · required

The spam tag name

@type: "Reject"

Reject

tag

Type: String · required

The spam tag name

JMAP API

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

x:SpamTag/get

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

This method requires the sysSpamTagGet permission.

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

x:SpamTag/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 sysSpamTagCreate permission.

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

Update

This operation requires the sysSpamTagUpdate permission.

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

Destroy

This operation requires the sysSpamTagDestroy permission.

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

x:SpamTag/query

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

This method requires the sysSpamTagQuery permission.

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

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

ConditionKind
tagtext

CLI

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

Fetch

stalwart-cli get spam-tag id1

Create

stalwart-cli create spam-tag/score \
--field tag=Example \
--field score=0

Query

stalwart-cli query spam-tag
stalwart-cli query spam-tag --where tag=example

Update

stalwart-cli update spam-tag id1 --field description='Updated'

Delete

stalwart-cli delete spam-tag --ids id1