How Does Email Know Where to Go?
When you type an email address for a message and hit send, how does the email know where to go?
Your email client (email software) wraps up your email along with certain information about the message, and sends the email to your SMTP Server (The SMTP server handles outgoing email. SMTP stands for Simple Mail Transfer Protocol) Which SMTP server you use is configured in your email software. Most people use the SMTP server provided by their Internet Service Provider (ISP). Or if you use web based email such as Hotmail or Yahoo mail, you have no control over the SMTP server — it is built in.
Your SMTP server accepts the email, looks up the IP address of the destination server, breaks the message up into packets, and sends the packets to the destination through a series of “hops” (usually a sequence of very high-powered routers). The path that your email takes through the internet is determined by the various routers. The routers used for internet routing have been compared with supercomputers. They look at various possible paths to the destination, and decide the best route to take. The individual packets may all use the same route, or some my go through one path, then the router may decide that there is too much traffic along that path, and send the rest of the packets through another path, or a variety of other paths.
Once all of the packets have been received, the destination server (usually a “POP” server) hooks the packets back together and places the email in a special file and waits for the recipient to request their email.
The email servers have an actual conversation. As you can see, below, they are even very polite. This is an actual conversation with the identifying information obfuscated. The sending server connects to the destination server. It says hello. The destination server replies with ELHO. They are even on a first name basis. The sending server says, “I have a message for one of your people, and it is this big.”
The destination server looks up the email address, and looks to see if it wants to, and is able to, receive email for the recipient. It then tells the sending server. “Ok, send it on”
The sending server then says, Ok, I am sending the message. You will know when it is done when you see two carriage return line feeds (CRLF) back to back. The receiving server then acknowledges receipt of the message and the conversation ends.