Skip to main content
Version: 0.16

SpamFileExtension

Defines a file extension classification rule for spam filtering.

This object can be configured from the WebUI under Settings › Spam Filter › Lists › File Extensions

Fields

extension

Type: String · read-only

The file name extension

isArchive

Type: Boolean · default: false

Whether this file extension is considered an archive

isBad

Type: Boolean · default: false

Whether this file extension is considered bad

isNz

Type: Boolean · default: false

Whether this file extension is considered a NZ file

contentTypes

Type: String[]

The MIME types associated with this file extension

JMAP API

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

x:SpamFileExtension/get

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

This method requires the sysSpamFileExtensionGet permission.

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

x:SpamFileExtension/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 sysSpamFileExtensionCreate permission.

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

Update

This operation requires the sysSpamFileExtensionUpdate permission.

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

Destroy

This operation requires the sysSpamFileExtensionDestroy permission.

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

x:SpamFileExtension/query

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

This method requires the sysSpamFileExtensionQuery permission.

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

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

ConditionKind
extensiontext

CLI

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

Fetch

stalwart-cli get spam-file-extension id1

Create

stalwart-cli create spam-file-extension \
--field isArchive=false \
--field isBad=false \
--field isNz=false \
--field 'contentTypes=[]'

Query

stalwart-cli query spam-file-extension
stalwart-cli query spam-file-extension --where extension=example

Update

stalwart-cli update spam-file-extension id1 --field description='Updated'

Delete

stalwart-cli delete spam-file-extension --ids id1