<commit_before># `rcpt_to.routes`

Recipient Routes does two things: recipient validation and MX routing.

## Recipient Validation

Recipients can be listed in the [routes] section of the config file
`config/rcpt_to.routes.ini` or in Redis. If Redis is available, it is checked
first. Then the config file is checked.

Entries can be email addresses or domains. If both are present, email
addresses are favored.

If no route is discovered, recipient processing continues, allowing other
recipient plugins to vouch for the recipient. If none does, the recipient is
rejected.

### Order of Recipient Search

1. Redis email
2. Redis domain
3. File email
4. File domain

## MX Routing

Each entry in the [routes] section of `config/rcpt_to.routes.ini` or in Redis
must specify a MX record. The MX record is the same format as _outbound.js_.
Examples:

    * hostname
    * hostname:port
    * ipaddress
    * ipaddress:port
    * { priority: 0, exchange: hostname, port: 25 }

## Configuration

The following options can be specified in `config/rcpt_to.routes.ini`:

### Redis

The [redis] section has three optional settings (defaults shown):

    [redis]
    server_ip=127.0.0.1
    server_port=6379
    db=0

### Routes

The [routes] section can include routes for domains and email addresses:<commit_msg>routes: added NOTE about setting always_split=true<commit_after># `rcpt_to.routes`

Recipient Routes does two things: recipient validation and MX routing.

## Recipient Validation

Recipients can be listed in the [routes] section of the config file
`config/rcpt_to.routes.ini` or in Redis. If Redis is available, it is checked
first. Then the config file is checked.

Entries can be email addresses or domains. If both are present, email
addresses are favored.

If no route is discovered, recipient processing continues, allowing other
recipient plugins to vouch for the recipient. If none does, the recipient is
rejected.

### Order of Recipient Search

1. Redis email
2. Redis domain
3. File email
4. File domain

## MX Routing

NOTE: MX routing by default routes *only* based on domains. To route for email
addresses, you must set the preference `always_split=true` in
config/outbound.js.

Each entry in the [routes] section of `config/rcpt_to.routes.ini` or in Redis
must specify a MX record. The MX record is the same format as _outbound.js_.
Examples:

    * hostname
    * hostname:port
    * ipaddress
    * ipaddress:port
    * { priority: 0, exchange: hostname, port: 25 }

## Configuration

The following options can be specified in `config/rcpt_to.routes.ini`:

### Redis

The [redis] section has three optional settings (defaults shown):

    [redis]
    server_ip=127.0.0.1
    server_port=6379
    db=0

### Routes

The [routes] section can include routes for domains and email addresses:
{'fraction_non_alphanumeric': 0.07160669754185964, 'fraction_numerical': 0.01282508015675098, 'mean_word_length': 3.978723404255319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1053239', 'n_tokens_mistral': 863, 'n_tokens_neox': 832, 'n_words': 371}