Skip to main content
Version: 0.16

MtaConnectionStrategy

Defines a connection strategy for outbound message delivery.

This object can be configured from the WebUI under Settings › MTA › Outbound › Connection Strategies

Fields

name

Type: String · read-only

Short identifier for the strategy

description

Type: String?

Short description of the connection strategy

ehloHostname

Type: HostName?

Overrides the EHLO hostname that will be used when connecting using this strategy

sourceIps

Type: MtaConnectionIpHost[]

List of local IPv4 and IPv6 addresses to use when delivering emails to remote SMTP servers

connectTimeout

Type: Duration · default: "5m"

Maximum time to wait for the connection to be established

dataTimeout

Type: Duration · default: "10m"

Maximum time to wait for the DATA command response

ehloTimeout

Type: Duration · default: "5m"

Maximum time to wait for the EHLO command response

greetingTimeout

Type: Duration · default: "5m"

Maximum time to wait for the SMTP greeting message

mailFromTimeout

Type: Duration · default: "5m"

Maximum time to wait for the MAIL-FROM command response

rcptToTimeout

Type: Duration · default: "5m"

Maximum time to wait for the RCPT-TO command response

JMAP API

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

x:MtaConnectionStrategy/get

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

This method requires the sysMtaConnectionStrategyGet permission.

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

x:MtaConnectionStrategy/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 sysMtaConnectionStrategyCreate permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:MtaConnectionStrategy/set",
{
"create": {
"new1": {
"connectTimeout": "5m",
"dataTimeout": "10m",
"description": "Example",
"ehloHostname": "mail.example.com",
"ehloTimeout": "5m",
"greetingTimeout": "5m",
"mailFromTimeout": "5m",
"rcptToTimeout": "5m",
"sourceIps": []
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

Update

This operation requires the sysMtaConnectionStrategyUpdate permission.

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

Destroy

This operation requires the sysMtaConnectionStrategyDestroy permission.

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

x:MtaConnectionStrategy/query

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

This method requires the sysMtaConnectionStrategyQuery permission.

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

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

ConditionKind
nametext

CLI

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

Fetch

stalwart-cli get mta-connection-strategy id1

Create

stalwart-cli create mta-connection-strategy \
--field description=Example \
--field ehloHostname=mail.example.com \
--field 'sourceIps=[]' \
--field connectTimeout=5m \
--field dataTimeout=10m \
--field ehloTimeout=5m \
--field greetingTimeout=5m \
--field mailFromTimeout=5m \
--field rcptToTimeout=5m

Query

stalwart-cli query mta-connection-strategy
stalwart-cli query mta-connection-strategy --where name=example

Update

stalwart-cli update mta-connection-strategy id1 --field description='Updated'

Delete

stalwart-cli delete mta-connection-strategy --ids id1

Nested types

MtaConnectionIpHost

Defines a source IP address and optional EHLO hostname override for outbound connections.

ehloHostname

Type: HostName?

Overrides the EHLO hostname that will be used when connecting from this IP address

sourceIp

Type: IpAddr · required

Local IPv4 and IPv6 address to use when delivering emails to remote SMTP servers