When asked for which purposes people most frequently use their computer, then the response often contains the term “email”. Yet in my experience most people have no clue how this digital letter gets from person X to person Y. This article will sketch a rough image of how email works.
Person X types an email in his/her mail client (to for example firstname.lastname@example.org). This can either be a web based or locally installed client. After pressing the “send” button, the email will be sent towards an outgoing mail server (MTA). This server will queue the mail, and lookup the location where this mail should be delivered by using a DNS server. Imagine the DNS server as a catalog of the internet. It contains (or can lookup) the network locations of a certain domain name (like example.com). The MTA will ask the DNS server to give the location of the mail server (mx record) for email@example.com.
After getting the needed information, it will try to send the mail to the SMTP server located at the given location. If it should occur that this server should be too busy, then the MTA will keep the mail queued. It will however try again at a regular interval, so that the mail gets delivered.
When the mail gets delivered, then it will be processed by the SMTP server. This processing may contain (several) anti virus & anti spam checks. After being approved it will be delivered to the to local mailbox. The recipient will fetch it’s mail on a frequent basis from this remote mailbox, and may do it’s own filtering upon it.
How come it sometimes is delivered within seconds, and sometimes within hours? Imagine the network internet as the road network of a busy city. When you have to go from point A to B, then you have to move a certain distance through traffic. This traffic might be dense at time, and practically non-existent at another moment in time. If your means of transportation breaks down, then you arrive (a bit) later then you planned. But every traffic light also increases your time of arrival.
The traffic lights represent each server that the email should pass, and the vehicle breakdown represent the delay caused by trying to resend when a certain server is down. And the congestion is the same in every network. A lot of traffic and insufficient road capacity cause traffic jams. So everyone gets stuck in traffic.