MtaRoute
Defines a routing rule for outbound message delivery.
This object can be configured from the WebUI under Settings › MTA › Outbound › Routes
Fields
Section titled “Fields”MtaRoute 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: "Mx"
Section titled “@type: "Mx"”Remote Delivery (MX)
ipLookupStrategy
Section titled “ipLookupStrategy”Type:
MtaIpStrategy· default:"v4ThenV6"IP resolution strategy for MX hosts
maxMultihomed
Section titled “maxMultihomed”Type:
UnsignedInt· default:2· min: 1For multi-homed remote servers, it is the maximum number of IP addresses to try on each delivery attempt
maxMxHosts
Section titled “maxMxHosts”Type:
UnsignedInt· default:5· min: 1Maximum number of MX hosts to try on each delivery attempt
Type:
String· read-onlyShort identifier for the route
description
Section titled “description”Type:
String?A short description of the route, which can be used to identify it in the list of routes
@type: "Relay"
Section titled “@type: "Relay"”Relay Host
Type:
String· requiredHostname or IP address of the remote SMTP server
Type:
MtaRelayAuth· default:{"@type":"None"}How to authenticate with the remote server
Type:
UnsignedInt· default:25· max: 65535 · min: 1The port number of the remote server, which is typically 25 for SMTP and 11200 for LMTP
protocol
Section titled “protocol”Type:
MtaProtocol· default:"smtp"The protocol to use when delivering messages to the remote server, which can be either SMTP or LMTP
allowInvalidCerts
Section titled “allowInvalidCerts”Type:
Boolean· default:falseWhether to allow connections to servers with invalid TLS certificates
implicitTls
Section titled “implicitTls”Type:
Boolean· default:falseWhether to use TLS encryption for all connections to the remote server
tlsSettings
Section titled “tlsSettings”Type:
TlsClientSettings· default:{"@type":"Default"}Trusted certificate authorities, revocation lists and client certificate used for TLS connections
Type:
String· read-onlyShort identifier for the route
description
Section titled “description”Type:
String?A short description of the route, which can be used to identify it in the list of routes
@type: "Local"
Section titled “@type: "Local"”Local Delivery
Type:
String· read-onlyShort identifier for the route
description
Section titled “description”Type:
String?A short description of the route, which can be used to identify it in the list of routes
JMAP API
Section titled “JMAP API”The MtaRoute object is available via the urn:stalwart:jmap capability.
x:MtaRoute/get
Section titled “x:MtaRoute/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysMtaRouteGet permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:MtaRoute/get", { "ids": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:MtaRoute/set
Section titled “x:MtaRoute/set”This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
Supports the following operations in a single call: create, update, destroy.
Create
Section titled “Create”This operation requires the sysMtaRouteCreate permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:MtaRoute/set", { "create": { "new1": { "@type": "Mx" } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Update
Section titled “Update”This operation requires the sysMtaRouteUpdate permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:MtaRoute/set", { "update": { "id1": { "description": "updated value" } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Destroy
Section titled “Destroy”This operation requires the sysMtaRouteDestroy permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:MtaRoute/set", { "destroy": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:MtaRoute/query
Section titled “x:MtaRoute/query”This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysMtaRouteQuery permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:MtaRoute/query", { "filter": { "name": "example" } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'The x:MtaRoute/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):
| Condition | Kind |
|---|---|
name | text |
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
stalwart-cli get MtaRoute id1Create
Section titled “Create”stalwart-cli create MtaRoute/Mxstalwart-cli query MtaRoutestalwart-cli query MtaRoute --where name=exampleUpdate
Section titled “Update”stalwart-cli update MtaRoute id1 --field description='updated value'Delete
Section titled “Delete”stalwart-cli delete MtaRoute --ids id1Nested types
Section titled “Nested types”MtaRelayAuth
Section titled “MtaRelayAuth”Authentication used when delivering messages through a relay host.
None: No authentication. No additional fields.Basic: Username and password. Carries the fields ofMtaRelayAuthBasic.OAuthToken: OAuth 2.0 access token. Carries the fields ofMtaRelayAuthToken.OAuthClient: OAuth 2.0 token endpoint. Carries the fields ofMtaRelayAuthClient.
MtaRelayAuthBasic
Section titled “MtaRelayAuthBasic”Username and password authentication with a relay host.
username
Section titled “username”Type:
String· requiredThe username to use when authenticating with the remote server
secret
Section titled “secret”Type:
SecretKey· requiredThe password to use when authenticating with the remote server
SecretKey
Section titled “SecretKey”A secret value provided directly, from an environment variable, or from a file.
Value: Secret value. Carries the fields ofSecretKeyValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
SecretKeyValue
Section titled “SecretKeyValue”A secret value provided directly.
secret
Section titled “secret”Type:
String· required · secretPassword or secret value
SecretKeyEnvironmentVariable
Section titled “SecretKeyEnvironmentVariable”A secret value read from an environment variable.
variableName
Section titled “variableName”Type:
String· requiredEnvironment variable name to read the secret from
SecretKeyFile
Section titled “SecretKeyFile”A secret value read from a file.
filePath
Section titled “filePath”Type:
String· requiredFile path to read the secret from
MtaRelayAuthToken
Section titled “MtaRelayAuthToken”Authentication with a relay host using a fixed OAuth 2.0 access token.
username
Section titled “username”Type:
String?The username sent with XOAUTH2 or OAUTHBEARER, usually the mailbox address
Type:
SecretKey· requiredThe OAuth 2.0 access token
MtaRelayAuthClient
Section titled “MtaRelayAuthClient”Authentication with a relay host using access tokens obtained from an OAuth 2.0 token endpoint.
username
Section titled “username”Type:
String?The username sent with XOAUTH2 or OAUTHBEARER, usually the mailbox address
tokenUrl
Section titled “tokenUrl”Type:
Uri· requiredThe token endpoint of the authorization server
clientId
Section titled “clientId”Type:
String· requiredThe OAuth 2.0 client identifier
clientSecret
Section titled “clientSecret”Type:
SecretKeyOptional· default:{"@type":"None"}The OAuth 2.0 client secret
refreshToken
Section titled “refreshToken”Type:
SecretKeyOptional· default:{"@type":"None"}Refresh token used with the refresh_token grant; when none is set, the client_credentials grant is used
Type:
String?Space separated scopes to request, for example https://outlook.office365.com/.default
SecretKeyOptional
Section titled “SecretKeyOptional”An optional secret value, or none.
None: No secret. No additional fields.Value: Secret value. Carries the fields ofSecretKeyValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
TlsClientSettings
Section titled “TlsClientSettings”TLS settings for outgoing connections.
Default: Default trust store, no client certificate. No additional fields.Custom: Custom. Carries the fields ofTlsClientSettingsCustom.
TlsClientSettingsCustom
Section titled “TlsClientSettingsCustom”Trusted certificate authorities and client certificate for outgoing TLS connections.
caCertificates
Section titled “caCertificates”Type:
PublicTextOptional· default:{"@type":"None"}Trusted certificate authorities in PEM format. When set, they replace the system trust store
revocationLists
Section titled “revocationLists”Type:
PublicTextOptional· default:{"@type":"None"}Certificate revocation lists in PEM format, checked against the trusted certificate authorities. Certificates issued by an authority without a matching list are accepted
verifyHostname
Section titled “verifyHostname”Type:
Boolean· default:trueWhether the server certificate must be valid for the hostname. When disabled, the certificate only needs to chain to a trusted certificate authority
certificate
Section titled “certificate”Type:
PublicTextOptional· default:{"@type":"None"}Client certificate chain in PEM format, leaf certificate first, presented to the remote server
privateKey
Section titled “privateKey”Type:
SecretTextOptional· default:{"@type":"None"}Private key of the client certificate in PEM format
PublicTextOptional
Section titled “PublicTextOptional”An optional text value provided directly, from an environment variable, or from a file, or none.
None: No value. No additional fields.Text: Text value. Carries the fields ofPublicTextValue.EnvironmentVariable: Text value read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Text value read from file. Carries the fields ofSecretKeyFile.
PublicTextValue
Section titled “PublicTextValue”A text value provided directly.
Type:
Text· requiredText value
SecretTextOptional
Section titled “SecretTextOptional”An optional secret text value, or none.
None: No secret. No additional fields.Text: Secret value. Carries the fields ofSecretTextValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
SecretTextValue
Section titled “SecretTextValue”A secret text value provided directly.
secret
Section titled “secret”Type:
Text· required · secretPassword or secret value
MtaIpStrategy
Section titled “MtaIpStrategy”| Value | Label |
|---|---|
v4ThenV6 | IPv4 then IPv6 |
v6ThenV4 | IPv6 then IPv4 |
v4Only | IPv4 Only |
v6Only | IPv6 Only |
MtaProtocol
Section titled “MtaProtocol”| Value | Label |
|---|---|
smtp | SMTP |
lmtp | LMTP |