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

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

# Delivery settings

The active queue delivery configuration can be used
to set parameters such as timeouts and connection pooling
based on fields that are only available in the active queue state,
such as *remotemx* and *remoteip*.
Because they might be generated by an external system,
or managed separately from the rest of the configuration,
they are loaded from a separate file.

The default
[start configuration](config_startup.html.md)’s
[`environment.deliveryconf`](config_startup.html.md#confval-environment.deliveryconf) directive
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)
[JSON schema](https://docs.halon.io/json-schemas/6.12-stable/) (included in our [Visual Studio Code integration](vscode.html.md)).

[Lists](config_smtpd.html.md#config-list) may be used to reference and match multiple values at the same time.

The following properties can be changed in the delivery settings file.

* TLS mode
* Pooling options
* Timeouts
* Retry (intervals and count, but not during)

The example below enable connection pooling, with priority for MXs on “example.com”:

```yaml
delivery:
  conditions:
    - if:
        remotemx: "*.example.com"
      then:
        pooling:
          enabled: true
          timeout: 300
          evictable: false
          transactions: 1000
        tls:
          mode: "optional"
    - if:
        remoteip: 192.0.2.1
      then:
        timeout:
          connect: 120
          smtp:
            MAIL: 900
            EOD: 900
  default:
    pooling:
      enabled: true
```
