Recipient MX Selection
Introduction
This document describes how GreenArrow, for remote delivery attempts, determines the order of mail exchanger servers to which to attempt delivery.
DNS Resolution
For remote delivery attempts, GreenArrow issues an MX query for the
recipient’s domain name. If no domains are returned, the A records for the
recipient’s domain name will be used for delivery.
The MX records are then sorted according to their ascending MX priority.
MX records with equal priority are randomized within that list.
GreenArrow then issues A record queries for the MX domain names it will attempt.
If an MX domain name has multiple A records, the order of those A records will be
randomized in the final list of IPs to which we will attempt delivery.
Example
Given this configuration
Recipient address:
MX records for example.com:
smtp1.example.com MX 10
smtp2.example.com MX 10
smtp3.example.com MX 10
smtp4.example.com MX 20
smtp5.example.com MX 20
smtp6.example.com MX 30
smtp7.example.com MX 40
smtp8.example.com MX 40
A records for the MX domain names:
smtp1.example.com A 127.0.0.1
smtp1.example.com A 127.0.1.1
smtp1.example.com A 127.0.2.1
smtp2.example.com A 127.0.0.2
smtp3.example.com A 127.0.0.3
smtp4.example.com A 127.0.0.4
smtp5.example.com A 127.0.0.5
smtp6.example.com A 127.0.0.6
smtp7.example.com A 127.0.0.7
smtp7.example.com A 127.0.1.7
smtp8.example.com A 127.0.0.8
These results occur
The MX servers of equal priority will be randomized; so in the list of MX servers,
smtp1.example.com, smtp2.example.com, and smtp3.example.com will be randomized – but
they will all be positioned ahead of smtp4.example.com etc.
Once that list is determined, each domain’s IPs are randomized and added to the list.
Here’s an example order we might attempt delivery:
smtp2.example.com A 127.0.0.2
smtp3.example.com A 127.0.0.3
smtp1.example.com A 127.0.2.1
smtp1.example.com A 127.0.1.1
smtp1.example.com A 127.0.0.1
smtp4.example.com A 127.0.0.4
smtp5.example.com A 127.0.0.5
smtp6.example.com A 127.0.0.6
smtp8.example.com A 127.0.0.8
smtp7.example.com A 127.0.1.7
smtp7.example.com A 127.0.0.7
Notice that each MX domain is still grouped together, but its individual A record IP
addresses have been randomized.
