<s>
A	O
mail	B-Protocol
exchanger	I-Protocol
record	I-Protocol
(	O
MX	B-Protocol
record	I-Protocol
)	O
specifies	O
the	O
mail	B-Protocol
server	I-Protocol
responsible	O
for	O
accepting	O
email	O
messages	O
on	O
behalf	O
of	O
a	O
domain	O
name	O
.	O
</s>
<s>
It	O
is	O
a	O
resource	O
record	O
in	O
the	O
Domain	B-Protocol
Name	I-Protocol
System	I-Protocol
(	O
DNS	B-Protocol
)	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
configure	O
several	O
MX	B-Protocol
records	I-Protocol
,	O
typically	O
pointing	O
to	O
an	O
array	O
of	O
mail	B-Protocol
servers	I-Protocol
for	O
load	O
balancing	O
and	O
redundancy	O
.	O
</s>
<s>
Resource	O
records	O
are	O
the	O
basic	O
information	O
element	O
of	O
the	O
Domain	B-Protocol
Name	I-Protocol
System	I-Protocol
(	O
DNS	B-Protocol
)	O
.	O
</s>
<s>
An	O
MX	B-Protocol
record	I-Protocol
is	O
one	O
of	O
these	O
,	O
and	O
a	O
domain	O
may	O
have	O
one	O
or	O
more	O
of	O
these	O
set	O
up	O
,	O
as	O
below	O
:	O
</s>
<s>
The	O
characteristic	O
payload	O
information	O
of	O
an	O
MX	B-Protocol
record	I-Protocol
is	O
a	O
preference	O
value	O
(	O
above	O
labelled	O
"	O
Priority	O
"	O
)	O
,	O
and	O
the	O
domain	O
name	O
of	O
a	O
mailserver	B-Protocol
(	O
"	O
Host	O
"	O
above	O
)	O
.	O
</s>
<s>
The	O
priority	O
field	O
identifies	O
which	O
mailserver	B-Protocol
should	O
be	O
preferred	O
-	O
in	O
this	O
case	O
the	O
values	O
are	O
both	O
10	O
,	O
so	O
mail	O
would	O
be	O
expected	O
to	O
flow	O
evenly	O
to	O
both	O
onemail.example.com	O
and	O
twomail.example.com	O
-	O
a	O
common	O
configuration	O
.	O
</s>
<s>
The	O
host	B-Protocol
name	I-Protocol
must	O
map	O
directly	O
to	O
one	O
or	O
more	O
address	O
records	O
(	O
A	O
,	O
or	O
AAAA	O
)	O
in	O
the	O
DNS	B-Protocol
,	O
and	O
must	O
not	O
point	O
to	O
any	O
CNAME	B-Protocol
records	I-Protocol
.	O
</s>
<s>
When	O
an	O
e-mail	O
message	O
is	O
sent	O
through	O
the	O
Internet	O
,	O
the	O
sending	O
mail	B-Protocol
transfer	I-Protocol
agent	I-Protocol
(	O
MTA	O
)	O
queries	O
the	O
Domain	B-Protocol
Name	I-Protocol
System	I-Protocol
for	O
the	O
MX	B-Protocol
records	I-Protocol
of	O
each	O
recipient	O
's	O
domain	O
name	O
.	O
</s>
<s>
This	O
query	O
returns	O
a	O
list	O
of	O
host	B-Protocol
names	I-Protocol
of	O
mail	B-Protocol
exchange	I-Protocol
servers	I-Protocol
accepting	O
incoming	O
mail	O
for	O
that	O
domain	O
and	O
their	O
preferences	O
.	O
</s>
<s>
The	O
system	O
allows	O
high-availability	B-General_Concept
clusters	I-General_Concept
of	O
mail	O
gateways	O
to	O
be	O
built	O
for	O
one	O
domain	O
if	O
necessary	O
.	O
</s>
<s>
The	O
MX	O
mechanism	O
does	O
not	O
grant	O
the	O
ability	O
to	O
provide	O
mail	O
service	O
on	O
alternative	O
port	B-Protocol
numbers	I-Protocol
,	O
nor	O
does	O
it	O
provide	O
the	O
ability	O
to	O
distribute	O
mail	O
delivery	O
across	O
a	O
set	O
of	O
unequal-priority	O
mail	B-Protocol
servers	I-Protocol
by	O
assigning	O
a	O
weighting	O
value	O
to	O
each	O
one	O
.	O
</s>
<s>
In	O
the	O
simplest	O
case	O
,	O
a	O
domain	O
may	O
have	O
just	O
one	O
mail	B-Protocol
server	I-Protocol
.	O
</s>
<s>
For	O
example	O
,	O
if	O
an	O
MTA	O
looks	O
up	O
the	O
MX	B-Protocol
records	I-Protocol
for	O
example.com,	O
and	O
the	O
DNS	B-Protocol
server	O
replied	O
with	O
only	O
mail.example.com	O
with	O
a	O
preference	O
number	O
of	O
50	O
,	O
then	O
the	O
MTA	O
will	O
attempt	O
delivery	O
of	O
the	O
mail	O
to	O
the	O
server	O
listed	O
.	O
</s>
<s>
If	O
there	O
is	O
more	O
than	O
one	O
MX	B-Protocol
record	I-Protocol
with	O
the	O
same	O
preference	O
number	O
,	O
all	O
of	O
those	O
must	O
be	O
tried	O
before	O
moving	O
on	O
to	O
lower-priority	O
entries	O
.	O
</s>
<s>
When	O
determining	O
which	O
server	O
of	O
equal	O
preference	O
to	O
send	O
mail	O
to	O
,	O
"	O
the	O
sender-SMTP	O
MUST	O
randomize	O
them	O
to	O
spread	O
the	O
load	O
across	O
multiple	O
mail	B-Protocol
exchangers	I-Protocol
for	O
a	O
specific	O
organization	O
"	O
,	O
unless	O
there	O
is	O
a	O
clear	O
reason	O
to	O
favor	O
one	O
.	O
</s>
<s>
An	O
alternative	O
approach	O
is	O
to	O
use	O
multihomed	B-Protocol
servers	O
,	O
where	O
the	O
one	O
host	O
returns	O
several	O
IP	O
addresses	O
.	O
</s>
<s>
This	O
method	O
places	O
the	O
burden	O
on	O
the	O
DNS	B-Protocol
rather	O
than	O
the	O
SMTP-sender	O
to	O
perform	O
the	O
load	O
balancing	O
,	O
which	O
in	O
this	O
case	O
will	O
present	O
a	O
list	O
of	O
IP	O
addresses	O
in	O
a	O
specific	O
order	O
to	O
the	O
clients	O
querying	O
the	O
A	B-Protocol
record	I-Protocol
of	O
the	O
mail	B-Protocol
exchanger	I-Protocol
.	O
</s>
<s>
Since	O
the	O
RFC	O
requires	O
that	O
the	O
SMTP-sender	O
use	O
the	O
order	O
given	O
in	O
the	O
A	B-Protocol
record	I-Protocol
query	O
,	O
the	O
DNS	B-Protocol
server	O
is	O
free	O
to	O
carefully	O
manipulate	O
its	O
balancing	O
based	O
on	O
any	O
method	O
,	O
including	O
round	B-Protocol
robin	I-Protocol
DNS	I-Protocol
,	O
mail	B-Protocol
server	I-Protocol
load	O
,	O
or	O
some	O
undisclosed	O
priority	O
scheme	O
.	O
</s>
<s>
Some	O
domains	O
will	O
have	O
several	O
MX	B-Protocol
records	I-Protocol
,	O
one	O
of	O
which	O
is	O
intended	O
as	O
a	O
"	O
backup	O
"	O
-	O
with	O
a	O
higher	O
preference	O
number	O
so	O
that	O
it	O
would	O
not	O
normally	O
be	O
picked	O
as	O
the	O
target	O
for	O
email	O
delivery	O
.	O
</s>
<s>
However	O
,	O
in	O
the	O
case	O
of	O
errors	O
from	O
the	O
lower-numbered	O
hosts	O
,	O
(	O
perhaps	O
due	O
to	O
an	O
outage	O
of	O
some	O
sort	O
)	O
,	O
sending	O
email	B-Protocol
servers	I-Protocol
will	O
deliver	O
to	O
the	O
"	O
backup	O
"	O
host	O
-	O
queue.example.com	O
in	O
the	O
example	O
below	O
:	O
</s>
<s>
In	O
the	O
absence	O
of	O
this	O
sort	O
of	O
arrangement	O
,	O
when	O
a	O
domain	O
's	O
mail	B-Protocol
servers	I-Protocol
are	O
all	O
offline	O
,	O
sending	O
servers	O
are	O
required	O
to	O
queue	O
messages	O
destined	O
for	O
that	O
domain	O
to	O
retry	O
later	O
.	O
</s>
<s>
The	O
SMTP	O
RFC	O
is	O
ambiguous	O
about	O
exactly	O
what	O
kinds	O
of	O
delivery	O
failure	O
must	O
result	O
in	O
re-attempting	O
delivery	O
via	O
more	O
distant	O
MX	B-Protocol
records	I-Protocol
(	O
those	O
with	O
higher	O
preference	O
values	O
)	O
.	O
</s>
<s>
However	O
,	O
when	O
the	O
sender	O
retries	O
,	O
the	O
RFC	O
is	O
silent	O
about	O
whether	O
this	O
should	O
be	O
to	O
the	O
same	O
server	O
,	O
or	O
a	O
more	O
"	O
distant	O
"	O
MX	B-Protocol
record	I-Protocol
.	O
</s>
<s>
Some	O
servers	O
(	O
such	O
as	O
Sendmail	B-Application
and	O
Postfix	B-Application
2.1	O
or	O
later	O
)	O
,	O
will	O
attempt	O
the	O
next-furthest	O
MX	O
server	O
after	O
some	O
types	O
of	O
temporary	O
delivery	O
failures	O
,	O
such	O
as	O
greeting	O
failures	O
.	O
</s>
<s>
Other	O
servers	O
(	O
such	O
as	O
qmail	B-Application
and	O
Postfix	B-Application
2.0	O
or	O
earlier	O
)	O
will	O
only	O
use	O
more	O
distant	O
MX	B-Protocol
records	I-Protocol
if	O
the	O
servers	O
specified	O
in	O
the	O
shortest-distance	O
MX	B-Protocol
records	I-Protocol
could	O
not	O
be	O
contacted	O
at	O
all	O
.	O
</s>
<s>
In	O
the	O
absence	O
of	O
an	O
MX	B-Protocol
record	I-Protocol
,	O
email	O
senders	O
will	O
attempt	O
delivery	O
to	O
the	O
address	B-Protocol
record	I-Protocol
-	O
e.g.	O
</s>
<s>
SMTP	O
clients	O
must	O
look	O
up	O
an	O
MX	B-Protocol
record	I-Protocol
;	O
</s>
<s>
It	O
makes	O
only	O
passing	O
references	O
to	O
DNS	B-Protocol
,	O
because	O
at	O
the	O
time	O
the	O
transition	O
from	O
HOSTS.TXT	O
to	O
the	O
DNS	B-Protocol
had	O
not	O
yet	O
started	O
.	O
</s>
<s>
RFC	O
883	O
,	O
the	O
first	O
description	O
of	O
the	O
DNS	B-Protocol
,	O
was	O
published	O
over	O
a	O
year	O
later	O
in	O
late	O
1983	O
.	O
</s>
<s>
According	O
to	O
RFC	O
897	O
and	O
RFC	O
921	O
,	O
the	O
transition	O
to	O
DNS	B-Protocol
started	O
in	O
1983	O
,	O
but	O
HOSTS.TXT	O
was	O
not	O
scheduled	O
to	O
be	O
phased	O
out	O
until	O
the	O
end	O
of	O
1985	O
and	O
was	O
not	O
totally	O
phased	O
out	O
until	O
the	O
late	O
1990s	O
.	O
</s>
<s>
In	O
January	O
1986	O
,	O
RFC	O
973	O
and	O
RFC	O
974	O
deprecated	O
the	O
MD	O
and	O
MF	O
records	O
,	O
replaced	O
them	O
with	O
MX	O
,	O
and	O
defined	O
the	O
MX	O
lookup	O
with	O
fallback	O
to	O
A	O
.	O
RFC	O
974	O
recommends	O
that	O
clients	O
do	O
a	O
WKS	B-Protocol
lookup	O
on	O
each	O
MX	O
host	O
to	O
see	O
if	O
it	O
actually	O
supports	O
SMTP	O
and	O
discard	O
the	O
MX	B-Protocol
entry	I-Protocol
if	O
not	O
.	O
</s>
<s>
However	O
,	O
RFC	O
1123	O
changed	O
this	O
to	O
say	O
that	O
WKS	B-Protocol
should	O
not	O
be	O
checked	O
.	O
</s>
<s>
MD	O
and	O
MF	O
were	O
hard	O
to	O
use	O
,	O
so	O
most	O
people	O
just	O
used	O
the	O
A	B-Protocol
record	I-Protocol
.	O
</s>
<s>
Under	O
the	O
circumstances	O
,	O
MX	O
without	O
fallback	O
to	O
A	O
would	O
not	O
have	O
worked	O
because	O
of	O
the	O
substantial	O
installed	O
base	O
of	O
mail	B-Protocol
servers	I-Protocol
using	O
A	B-Protocol
records	I-Protocol
.	O
</s>
<s>
The	O
early	O
use	O
of	O
MX	O
was	O
to	O
identify	O
gateways	O
to	O
other	O
networks	O
,	O
but	O
it	O
did	O
not	O
come	O
into	O
wide	O
use	O
until	O
the	O
DNS	B-Protocol
was	O
well	O
established	O
in	O
the	O
early	O
1990s	O
.	O
</s>
