[Techtalk] Routing mail
mary-linuxchix at puzzling.org
Fri Jun 13 18:43:08 EST 2003
On Fri, Jun 13, 2003, Dan Richter wrote:
> Hi everyone.
> As I understand it, a mail to me at foo.com may automatically be routed to
> mail.foo.com. But does anyone know how the SMTP server knows that mail to
> foo.com is actually supposed to go to mail.foo.com?
Which SMTP server? The sender's (at random.example.com) or the
recipient's (at foo.com)?
The sender's SMTP server at random.example.com (it's actually playing
the client role in the SMTP transaction) looks at the MX (mail
exchanger) DNS records to determine which server handles mail for
foo.com. If there is no MX record, it uses the A record instead.
Let's try this out with my domain, puzzling.org:
$ host -t MX puzzling.org
puzzling.org mail is handled by 10 mail63.csoft.net.
puzzling.org mail is handled by 20 sumo.solutionsfirst.net.
I just asked for the MX records and got two replies. The numbers 10 and
20 are priorities, and the *lowest* number is the main mailserver. If
the secondaries (with higher numbers) receive mail, they're meant to
forward it to the primary.
If a SMTP client failed to get a response to the request for MX records,
it would use the A record instead.
On the other hand, if you meant "how does foo.com route all mail to
mail.foo.com?" this is generally done uses files like /etc/aliases
 If you ever need an example domain, example.com is reserved for use
in examples just like this.
More information about the Techtalk