<a id="delivery-configuration"></a>

# Delivery configuration

This file contains delivery configuration, including settings like pooling and retries.
Similar to the `smtpd-suspend.yaml` and `smtpd-policy.yaml` configuration files, it can be updated more independently.
These settings can also be modified using the HSL Pre-delivery hook. However,
unlike the Pre-delivery hook, this file supports conditions based on `grouping`, `remoteip`, and `remotemx`,
which are resolved after the Pre-delivery hook runs.
By default, *smtpd* loads it from  */etc/halon/smtpd-delivery.yaml*.
It is described by, and can be validated with, the
[smtpd-delivery.schema.json](http://lbovet.github.io/docson/index.html#https://docs.halon.io/json-schemas/6.12-stable/smtpd-delivery.schema.json).
This file can be reloaded using the `halonctl queue delivery reload` command.

<a id="delivery-directives"></a>

## Delivery directives

<a id="confval-delivery.conditions"></a>

### delivery.conditions[]

Conditions can be used to apply settings.
From a performance perspective it’s beneficial to use *string* and  *\*.domain* over *regex* patterns.

<a id="confval-delivery.conditions-.if.tenantid"></a>

### delivery.conditions[].if.tenantid

Supported types are *string*,  */regex/* or a  *@list* of those.

<a id="confval-delivery.conditions-.if.jobid"></a>

### delivery.conditions[].if.jobid

Supported types are *string*,  */regex/* or a  *@list* of those.

<a id="confval-delivery.conditions-.if.transportid"></a>

### delivery.conditions[].if.transportid

Supported types are *string*,  */regex/* or a  *@list* of those.

<a id="confval-delivery.conditions-.if.localip"></a>

### delivery.conditions[].if.localip

Supported types are *ipv4*, *ipv4network*, *ipv6*, *ipv6network* or  *@list* of those.

<a id="confval-delivery.conditions-.if.grouping"></a>

### delivery.conditions[].if.grouping

Supported types are *string*,  *\*.domain*,  */regex/* or a  *@list* of those.

<a id="confval-delivery.conditions-.if.remoteip"></a>

### delivery.conditions[].if.remoteip

Supported types are *ipv4*, *ipv4network*, *ipv6*, *ipv6network* or  *@list* of those.

<a id="confval-delivery.conditions-.if.remotemx"></a>

### delivery.conditions[].if.remotemx

Supported types are *domain*,  *\*.domain*,  */regex/* or a  *@list* of those.

<a id="confval-delivery.conditions-.if.recipientdomain"></a>

### delivery.conditions[].if.recipientdomain

Supported types are *domain*,  *\*.domain*,  */regex/* or a  *@list* of those.

<a id="confval-delivery.conditions-.then.tls.mode"></a>

### delivery.conditions[].then.tls.mode

The TLS mode that should be used. One of `disabled`, `optional`, `optional_verify`, `require`, `require_verify`, `dane`, `dane_require`, `dane_fallback_require`, `dane_fallback_require_verify`, or `trust`. The default is `optional`.

<a id="confval-delivery.conditions-.then.tls.protocols"></a>

### delivery.conditions[].then.tls.protocols

The TLS protocols that should be supported. The default is `!SSLv2,!SSLv3,!TLSv1,!TLSv1.1`.

<a id="confval-delivery.conditions-.then.tls.ciphers"></a>

### delivery.conditions[].then.tls.ciphers

The TLS ciphers that should be used (<=TLSv1.2). The default is `aNULL:-aNULL:HIGH:MEDIUM:+RC4:@STRENGTH`.

<a id="confval-delivery.conditions-.then.tls.ciphersuites"></a>

### delivery.conditions[].then.tls.ciphersuites

The TLS cipher suites that should be used (TLSv1.3).

<a id="confval-delivery.conditions-.then.tls.groups"></a>

### delivery.conditions[].then.tls.groups

The supported groups to offer for TLS key exchange.

<a id="confval-delivery.conditions-.then.tls.trustanchor"></a>

### delivery.conditions[].then.tls.trustanchor[]

The TLS trust anchors.

<a id="confval-delivery.conditions-.then.tls.trustanchor-.selector"></a>

### delivery.conditions[].then.tls.trustanchor[].selector

The trust selector (integer).

<a id="confval-delivery.conditions-.then.tls.trustanchor-.mtype"></a>

### delivery.conditions[].then.tls.trustanchor[].mtype

The trust match type (integer).

<a id="confval-delivery.conditions-.then.tls.trustanchor-.data"></a>

### delivery.conditions[].then.tls.trustanchor[].data

The trust data (hex encoded).

<a id="confval-delivery.conditions-.then.pooling.enabled"></a>

### delivery.conditions[].then.pooling.enabled

If connection pooling should be enabled. The default is `false`.

<a id="confval-delivery.conditions-.then.pooling.evictable"></a>

### delivery.conditions[].then.pooling.evictable

If the connection is evictable from the cache due to the cache replacement policy (LRU) if the cache is full. The default is `true`.

<a id="confval-delivery.conditions-.then.pooling.timeout"></a>

### delivery.conditions[].then.pooling.timeout

The idle timeout (in seconds) before an unused connection is closed. This setting support time format syntax (eg. `5s`). The default is `5` seconds.

<a id="confval-delivery.conditions-.then.pooling.transactions"></a>

### delivery.conditions[].then.pooling.transactions

The transactions per connection (0 is unlimited). The default is *unlimited*.

<a id="confval-delivery.conditions-.then.timeout.connect"></a>

### delivery.conditions[].then.timeout.connect

The connect timeout (in seconds).
This setting support time format syntax (eg. `30s`).
The default is `30` seconds.

<a id="confval-delivery.conditions-.then.timeout.smtp."></a>

### delivery.conditions[].then.timeout.smtp.{}

The connection timeout settings (in seconds) for one of below.
This setting support time format syntax (eg. `2m`).
The default is defined by the RFC.

* `BANNER`
* `HELO`
* `EHLO`
* `LHLO`
* `STARTTLS`
* `AUTH-CRAM-MD5`
* `AUTH-PLAIN`
* `AUTH-LOGIN`
* `AUTH-LOGIN-USER`
* `AUTH`
* `XCLIENT`
* `MAIL`
* `RCPT`
* `DATA`
* `EOD`
* `RSET`
* `NOOP`
* `QUIT`

<a id="confval-delivery.conditions-.then.retry.interval"></a>

### delivery.conditions[].then.retry.interval

See [`transportgroups[].retry.intervals[]`](config_smtpd.html.md#confval-transportgroups-.retry.intervals).

<a id="confval-delivery.conditions-.then.extensions.chunking"></a>

### delivery.conditions[].then.extensions.chunking

Enable support for the CHUNKING extension. The default is `true`.

<a id="confval-delivery.conditions-.then.extensions.pipelining"></a>

### delivery.conditions[].then.extensions.pipelining

Enable support for the PIPELINING extension. The default is `true`.

<a id="confval-delivery.default"></a>

### delivery.default

The default settings that will apply if not match any `policies[].conditions`.

<a id="confval-delivery.default.tls.mode"></a>

### delivery.default.tls.mode

The TLS mode that should be used. One of `disabled`, `optional`, `optional_verify`, `require`, `require_verify`, `dane`, `dane_require`, `dane_fallback_require`, `dane_fallback_require_verify`, or `trust`. The default is `optional`.

<a id="confval-delivery.default.tls.protocols"></a>

### delivery.default.tls.protocols

The TLS protocols that should be supported. The default is `!SSLv2,!SSLv3,!TLSv1,!TLSv1.1`.

<a id="confval-delivery.default.tls.ciphers"></a>

### delivery.default.tls.ciphers

The TLS ciphers that should be used (<=TLSv1.2). The default is `aNULL:-aNULL:HIGH:MEDIUM:+RC4:@STRENGTH`.

<a id="confval-delivery.default.tls.ciphersuites"></a>

### delivery.default.tls.ciphersuites

The TLS cipher suites that should be used (TLSv1.3).

<a id="confval-delivery.default.tls.groups"></a>

### delivery.default.tls.groups

The supported groups to offer for TLS key exchange.

<a id="confval-delivery.default.pooling.enabled"></a>

### delivery.default.pooling.enabled

If connection pooling should be enabled. The default is `false`.

<a id="confval-delivery.default.pooling.evictable"></a>

### delivery.default.pooling.evictable

If the connection is evictable from the cache due to the cache replacement policy (LRU) if the cache is full. The default is `true`.

<a id="confval-delivery.default.pooling.timeout"></a>

### delivery.default.pooling.timeout

The idle timeout (in seconds) before an unused connection is closed. This setting support time format syntax (eg. `5s`). The default is `5` seconds.

<a id="confval-delivery.default.pooling.transactions"></a>

### delivery.default.pooling.transactions

The transactions per connection (0 is unlimited). The default is *unlimited*.

<a id="confval-delivery.default.timeout.connect"></a>

### delivery.default.timeout.connect

The connect timeout (in seconds).
This setting support time format syntax (eg. `30s`).
The default is `30` seconds.

<a id="confval-delivery.default.timeout.smtp."></a>

### delivery.default.timeout.smtp.{}

The connection timeout settings (in seconds) for one of below.
This setting support time format syntax (eg. `2m`).
The default is defined by the RFC.

* `BANNER`
* `HELO`
* `EHLO`
* `LHLO`
* `STARTTLS`
* `AUTH-CRAM-MD5`
* `AUTH-PLAIN`
* `AUTH-LOGIN`
* `AUTH-LOGIN-USER`
* `AUTH`
* `XCLIENT`
* `MAIL`
* `RCPT`
* `DATA`
* `EOD`
* `RSET`
* `NOOP`
* `QUIT`

<a id="confval-delivery.default.retry.interval"></a>

### delivery.default.retry.interval

See [`transportgroups[].retry.intervals[]`](config_smtpd.html.md#confval-transportgroups-.retry.intervals).

<a id="confval-delivery.default.extensions.chunking"></a>

### delivery.default.extensions.chunking

Enable support for the CHUNKING extension. The default is `true`.

<a id="confval-delivery.default.extensions.pipelining"></a>

### delivery.default.extensions.pipelining

Enable support for the PIPELINING extension. The default is `true`.
