The concept of electronic mail is older than the concept of Internet or ARPANET itself, as it made its first appearance in the 1960s. Electronic mail is a technology used by people to exchange digital messages across a network. It is asynchronous, in the sense that users need not be online all the time in order to communicate. Each user has a mailbox, hosted in an SMTP mail server, which in turn is defined as the MX record of a domain name.
An email address is a unique identification name corresponding to an electronic mailbox. Anyone can send an email to anyone, provided the address is known and is working. Usually, it comes in this form :
The username part, is the unique name identifying the owner of the mailbox, while the domain.ltd part is the domain name which provides the email service.
An email consists of three parts. The header, the header fields, and the message body itself. If you wish to view these fields, you have to view the “raw source” of an email. All email providers offer this functionality (usually in the form of a link or button in every email).
- From: The sender’s email address.
- To: The recipient’s email address.
- Date: The date when the email was sent.
There are also some optional fields that provide extra information:
- Subject: The email’s subject.
- Received: This field provides extra information about every intermediate server the message has passed from, as well as the time-stamp when it was processed.
- Reply-To: When this address is specified, the reply from the recipient is delivered there; and not to the original address that was used to send the email from.
- Message-ID: A field providing a unique string that identifies the message.
There is also a special type of “custom headers” beginning with X, for example X-Spam-hits, or X-SMTPAPI. These headers are created automatically by external software, like spam detectors, email clients and filters to pass additional information about the email. SMTP mail servers ignore these.
Binary file attachments
In the beginning, email supported only latin 7 bit ASCII characters. As the years progressed, the need for binary file transfers arose. Modern mail transport agents implement this functionality by converting non-printable binary data into something called base64. What is base64 you might ask? Well, Base64 is a way to represent binary data using printable ASCII characters. This is an example of base64 encoded binary data:
Besides base64 there is also the 8BITMIME and BINARY extensions but these are not fully supported by all SMTP servers.
What happens when you send an email
The following diagram depicts the process of sending and receiving email. There are different protocols for each function. SMTP (Send Mail Transfer Protocol) is responsible for sending, storing and forwarding emails to other SMTP servers, while POP3 (Post Office Protocol) and IMAP (Internet Message Access Protocol) are used for receiving email.
- The user composes an email using a mail client (like Thunderbird, or Gmail) and then connects to the SMTP server providing the correct credentials. The SMTP server is usually provided by the user’s ISP.
- The SMTP server looks up the recipient’s address and domain to determine the email’s destination.
- The server queries the nameserver of that domain, in order to get the MX records (the MX records if you remember are the ones that define the mail server that is responsible for handling that domain).
- Then the server connects to the recipient’s domain SMTP mail server, and forwards the email. There are cases where the forwarding goes through multiple SMTP servers. This happens because corporate entities usually have more than one mail server, depending on their organizational or technical design.
- The receiving server stores the email and makes it available to the user for viewing and downloading through the POP3/IMAP protocol.
Viewing and getting new emails
Users can receive new emails by using their email client and connecting to the POP3 or IMAP service. The POP3/IMAP protocol is used only for receiving email while the SMTP is used for sending. ISPs usually provide both services as they are quite different. With the POP3 protocol the users connect to the server and need to download all their new messages before they can read them. POP3 has the available option of deleting the messages after downloading them or even marking them as read. With the IMAP4 protocol, however, users can connect to the server and download only the new message they wish to open and not all of them. Also, IMAP supports folders while POP3 does not.
Spam, the pollution of email
Unsolicited bulk email, or spam as it is more commonly called has been a real headache for Internet engineers since the get go. Its first use appeared in the 70s, and now more than 70% of the Internet’s total email traffic is said to be spam. Hopefully, since the 70s, spam-detecting technology has vastly improved.
As we’ve already mentioned in the Let’s Encrypt blog post, any data that is transmitted in plaintext between computers on the Internet, can be eavesdropped. Secure email solves this by using the same public key encryption that SSL uses to encrypt emails between two users (Alice and Bob) while digitally signing their identity. There are a lot of encryption suits available out there! The most popular of which is the open source GnuPG project.
This is how we conclude the last part of our introductory series about core Internet technologies. All the technologies that we’ve briefly covered are very complex and as you can understand each one easily warrants a series of posts for itself. We will continue by slowly addressing more complex topics, suited to WordPress developers, along with many surprises!
Christmas is a period of celebration, gift giving and love, but also of reflection, relaxation and tinkering!