For many people, sending and receiving emails is one of the most important internet services in both their personal and professional lives. What many people don’t realise, however, is what actually happens from a technical point of view when we write an email and click the ‘send’ button.
The protocol behind sending emails is known as SMTP (Simple Mail Transfer Protocol). Messages are retrieved either via IMAP or POP3. Other programs, such as mail user agents and mail transfer agents, are also used. This guide explains the different types of software agents available, the stages an email goes through during the sending process, and the types of problems that may arise whilst sending.
How does email work?
As soon as the email is sent, a webmail service opens on your computer via a web browser or a locally installed email program (also known as an email client). The technical term for an email program is ‘mail user agent’ (also known as a ‘message user agent’ or ‘MUA’).
Once you have written your message in your email client and clicked the ‘Send’ button, the sending process begins. Before the email reaches the recipient, it must first pass through various stages where it is formatted, checked and forwarded.
1. Forwarding emails via an MUA
Once you have sent the email, your email program must first format the message. The MUA divides the message into two categories: the header and the body. The header contains information about the sender, as well as the date and time of sending. You can choose to add further information, such as the subject line or the recipient’s name. The content of the message is known as the email body, which includes not only the text but also any attachments (documents and images).
2. Checking an email via an MTA
The email client communicates with the email provider’s mail server. The mail server has a program that is always online to receive and send emails: the Mail Transfer Agent (MTA). The MTA forms the software foundation of the mail server.
To reduce the load on the MTA, a Message Submission Agent (MSA) can be installed. This communicates directly with the email program and checks whether the address appears to be correct and belongs to a valid domain. The agent rejects invalid email addresses and forwards valid ones to the MTA. The MSA is often already integrated into an MTA program.
Before the email provider’s MTA sends the message, it first checks that it does not exceed the permitted size (which is usually 4–20 MB, depending on the email provider). If the email or its attachments are too large, you will be notified and the message will not be sent. Most email service providers check messages for spam or malware (e.g. viruses or Trojans) before they are sent. If no spam is detected and the email is within the permitted size, the MTA saves the sent message.
3. The sending process up to the recipient’s MTA
In the next step, the mail transfer agent looks up the recipient’s mail server in the domain name system (online address book), unless the MSA has already carried out this step. If the correct server is found, the local part of the address (everything before the ‘@’ symbol) is checked to see if it exists. If the email address cannot be found (because it contains a typo or does not exist), the MTA returns the message to the sender along with an explanation of the problem. If everything is in order, the MTA forwards the message to the recipient’s mail server.
During this process, the message (just like other traffic) is split into several parts. Sending individual packets (with a maximum size of 64 KB) has its advantages: on the one hand, smaller emails are easier to transmit. On the other hand, it is possible that different parts of the email use different data paths to reach the intended mail server. A packet always chooses the transmission path with relatively low traffic.
Traffic between mail servers is based on the use of internet exchange points. An infinite amount of data is exchanged via these exchange points, making them fundamental components of the internet infrastructure. This is where email service providers exchange messages with one another. Individual email packets pass through these distribution nodes to reach the recipient’s mail server, where they are reassembled.
4. Second check at the destination MTA and delivery of the postal item.
The email has arrived at the recipient’s mail server. Before the email reaches the actual recipient, the MTA checks the recipient of the incoming message. It checks the size of the attachment again to ensure it fits within the recipient’s email provider’s capacity. If it is too large, it is returned to the sender. The message is then checked again for spam content and malware. If anything suspicious is found (e.g. certain terms such as ‘Viagra’ in the text, known viruses or other malware in the attachment, or if the sender is known to send spam), the email is flagged or its delivery is blocked.
If the email successfully passes these checks, the message is stored on the recipient’s mail server and can be retrieved by the recipient. The mail delivery agent (MDA) sends the message to the recipient’s email inbox. As soon as the recipient logs into their inbox, the MUA they are using connects to the mail server’s MTA. The content is checked once more for spam and malware, but this time by the recipient’s email program.
The email is then in your inbox, ready to be opened and read. The numerous stages and security measures ensure that as few unwanted or harmful emails as possible end up in your inbox. All these processes that an email must go through before reaching the recipient take just a few seconds.