Internet Technologies/Routing email
Email routing is performed based entirely on the destination address of the email message. An email address has the following format:
username @ domain
(For example: email@example.com)
While it would be theoretically possible for mail clients to deliver their own messages directly to recipients, this is not desirable. So, an end user's mail client will deliver outbound messages to their local mail server using SMTP or a similar protocol.
The local mail server then performs a DNS lookup to find the 'MX' (mail exchanger) records for the recipient's domain name. These MX devices are the designated mail servers for all email addresses within that domain.
The local server then attempts an SMTP connection to each of the MX servers in order of priority, until a connection is successful. It forwards the message to the remote server and ends the connection.
The remote mail server then either repeats this process, forwarding the message closer to the intended recipient, or may deliver the message directly to the recipient.
Prior to the advent of the SMTP protocol, email was delivered using the UUCP (Unix-to-Unix Copy Protocol).
In the early days of SMTP, before Spam became a massive problem on the Internet, it was possible to manually define the route that an email message was to take. This was done by appending multiple "@domain" entries to a recipient address. For example:
A message with this recipient address would be routed first to the mail server for domain3.com, then to the mail server for domain2.com, then finally to the mail server for domain1.com where it would be delivered to the local user.
Due to anti-relaying restrictions now in place on Internet-accessible mail servers, this is generally no longer possible.