How does email work?

A lot happens when you hit "Send":

1. Email messages are composed using an email program (an email client).

2. The email program assembles the email by combining the message content (the body) with the recipient, subject, date, and time (the header).

3. Email relies on a set of protocols to arrive at the correct destination.

4. The email program (the email client) comes in two forms, a web-based version like Gmail, where users must log in through their browser to access their emails, or a client-based version such as Outlook, where users install software to access emails from their local computer.

If you regularly use a computer, it’s pretty likely you send and receive countless emails each day—emails from clients, subscriptions, newsletters, messages from friends and family, and not to mention spammers. Most internet users don’t know these emails are sent or arrive in their inbox, and that’s okay. From the typical email user's standpoint, it seems simple. We think of email as something that pops up when messages come through to our mail client (Thunderbird, Yahoo, Outlook, etc.).

When you send an email to your Mom, you type her email address, compose, hit send, and her reply comes back to your email client. To some extent, this is true, but there’s much more to it than that. How emails are structured and transmitted is a complex process, and with the help of relatable analogies, we can explain the entire process in an easy to absorb manner.

For most email users, it’s not necessary to understand how email works to use it. If you’re interested in how these messages ping into your inbox, stick with us. This short introduction is to help you understand the basic principles of email. It’s surprising how similar the process of emailing is to the old-fashioned written format. If you’ve ever written a formal letter, you'll have no trouble getting your head around how email works.

What is email



Email was actually invented before the publicly accessible internet as we know it. Email was conceived as a means for computers to communicate with one another. From the early 1960s, the computer network ARPANET, a computer communications network created by the United States Department of Defense, developed a system of email transfers that relied upon the now-familiar "@" sign. Ray Tomlinson, the man widely acknowledged to have masterminded email as we know it chose the @ symbol deliberately.

According to Tomlinson, "The primary reason was that it made sense. The @ sign didn't appear in names, so there would be no ambiguity about where the separation between login name and hostname occurred. (Raytheon BBN Technologies, 11 February 2011).

The @ symbol allowed messages to target individual users on specific machines and not to localhost. The format of the email address was now username@host. This separation of usernames from machine names works similarly to how website IP addresses are allocated domain names. Once the domain name system (DNS) was developed, email addresses took the format loginname@host.domain.




Emails are routed to user accounts via several computer servers. They route the message to their final destination and store them so that users can pick them up and send them once they connect to the email infrastructure. Email can be accessed through an email client or a web interface (more about these later). When you click send, the message is transmitted from your computer to the server associated with the recipient’s address. This process typically occurs via several other servers before the message gets to its intended recipient's mailbox.

Electronic mailboxes are central to how emails work for the end-user. A mailbox is where electronic mailboxes are stored, and when a user receives an email, the mail system automatically puts it in their mailbox. The mailbox makes emails user-friendly. They separate emails into folders, inbox, outbox, spam, etc., and allow users to scan mail, copy, delete, or forward it to another user. But what happens before it hits the mailbox?

Email servers (SMTP and MTA)



Unlike your physical mailbox, where one service, the post office, handles all of your mail, your incoming and outgoing mail is handled differently with email. There are two types of servers. The Simple Mail Transfer Protocol (SMTP) an email delivery protocol used to send mail over the internet. SMTP contains information regarding the transmission details of an email message and is specifically used for outgoing mail. A Mail Transfer Agent (MTA) is a server program that uses SMTP to deliver emails.

There are two types of MTA, a client-based MTA, which involves installing software to access emails (such as Outlook), and a web-based MTA, accessed through a web browser (Gmail, for example). Anyone can use their computer to run an MTA.

It’s fairly easy, and an MTA will handle incoming mail well. Running your own MTA to deliver a high-volume of bulk-emails while maintaining a good level of deliverability will get complicated. There are standards and conventions that need to be followed. Failure to adhere to them will hurt your ability to deliver mail reliably. A shorter, more straightforward route would be configuring your clients to use your ISP’s SMTP server instead of setting up and running your own.

Sending mail is a different story. SMTP relies on the TCP port 25. When an email is sent, Port 25 is typically used to route the message to a local computer, designated with handling e-mail by a network operator. This email server is pre-approved by the email host, handles incoming email messages, and sends messages. The problem with Port 25 is that it gets clogged with spam emails if computers on the same network become infected with malicious software or a virus. For this reason, most anti-spam guidelines propose blocking port 25.

Unless users host their own email, they can’t send mail themselves since most internet service providers block Port 25, and SMTP servers require static IP addresses to do their job. Port 25 blocking allows ISPs to eliminate any spam that’s sent out through their networks. There is a snag, blocking this port tends to punish the innocent that need to send through email servers other than those belonging to their ISP.

The reason for blocking anyone and everyone from sending emails is to keep the internet in some working condition. Consider the massive amounts of spam that would be eating away at our collective bandwidth. Indeed, software that transfers electronic mail messages should be configured to filter it out, but if it weren’t, there would be no joy in opening that mailbox. The main thing to understand is that both an MTA and an SMTP server are needed to use email, as each is specialized for what it does.

How email works



The moment an email is sent, a message is routed from server to server via the Simple Mail Transfer Protocol until it makes its way from the client to the email recipient’s email server.

1. Sending an email is just like sending a letter to a friend. Let’s say isobel@example.com sends an email to their friend simon@example.com. The email gets sent first to an outgoing mail server (SMTP) whose job, just like that of the post office, is to transport emails. The SMTP checks the postage address to figure out where to send the mail. Unfortunately, the SMTP doesn’t understand how to read the domain name (just like the mailman consults a map since he doesn’t know every street name by memory). The SMTP needs a computer-friendly IP address to locate and deliver the message to the recipient. To find the IP, the SMTP contacts the DNS server (the Internet’s phone book) to translate the recipient’s email address, simon@example.com, to an IP address like "45.789.56.89". Once the associated IP has been found, it checks if that domain has any mail exchange servers (MX) which detail any information about where the message should be sent. This is just like checking if the recipient uses a mailbox or a PO box to receive their mail in real life.

2. The SMTP has all the necessary information about the recipient to send the message from its server onto the email recipient’s MTA server.

3. The MTA decides where to put the mail and whether the recipient uses a client that works via POP or via the IMAP protocol. The recipient will then receive a new email notification, and the mail will wait in the mailbox until it is fetched.

So there you have it, email transmission works in virtually the same way as sending real mail. Once an email is sent, the mail server puts it in an envelope (the SMTP protocol connection). Let’s take a look at how this works.
  • Once an email is composed and the send button is clicked, the message is sent to the Mail Transfer Agent (MTA). This communication is done via the Simple Mail Transfer Protocol (SMTP).
  • The SMTP queries the Domain Name System (DNS) to find the address of the recipient. This is done with the help of a Mail eXchanger (MX) record. The MX record is a resource record that specifies the mail server of a domain name. Once located, the SMTP server will send the message to that server.
  • The next step involves transferring the message between mail servers. The message is now in the recipient’s mail server (MTA). The receiving server will store the message and make it available to the recipient, who can access it via the web, POP, or IMAP protocols.

Email protocols



Mail Transfer Agents (MTAs) communicate with each other over the internet using SMTP protocol (SMTP servers). The recipient’s MTA then forwards the email to the incoming mail server (MDA, mail delivery agent), tasked with storing the mail until the user accepts it. To retrieve email on an MDA, a supporting protocol must be used. There are two main protocols, POP3 and IMAP. You might recognize these two acronyms since incoming mail servers are called POP servers, or IMAP servers, depending on which protocol they use.

Pop vs. IMAP



POP stands for Post Office Protocol. This piece of software is used for retrieving email. POP3 gives an email user access to their emails stored in their user account on that server. You don’t need to stay online for the emails to come through. You just need to leave a copy of an email on the server to access it.

POP does have some drawbacks; namely, information transmitted through POP travels one way. This means that once an email is downloaded to a client, the client takes charge of sorting through the different status flags (e.g., sent, deleted, or answered). This was fine when the internet was young, before smartphones, tablets, and the like. People accessed their mail from a single location. Nowadays, it’s more likely that you access emails from many places; thunderbird at home, the mail app on your cell phone, or a web interface when you are at work, for example. With POP, you would have to sort through the information over each different device — assuming you’ve saved a copy of each email on the server.

IMAP (Internet Message Access Protocol) is a bit smarter about how it coordinates emails. IMAP clients have two-way communication with their servers. The IMAP protocol saves a copy of every message on the server so that, unlike with POP, multiple clients can access them. It’s completely synchronized. With IMAP, when you check an email on your tablet, it will be marked as read when you check your inbox on your phone. This happens because the status of the email is updated with all other clients during the server interaction.

IMAP is just like when your mail is categorized and stored at the post office for you and redelivers it when you are at home, at work, or pick it up in person. You can keep a properly marked archive on your home client as well as on your mail server. IMAP has an offline mode where any changes are synced with the server the next time you’re online. You may configure IMAP mail servers to fetch mail from POP inboxes, too, which works well if you’re seeking to consolidate. Of course, given that IMAP works with the "cloud" best, servers get involved, and storage can be problematic. Thankfully, storage space and bandwidth isn’t as pricey as it once was, but this will truly be a change-off for a few humans.

How email is received



Let’s now take a look at how email is received. No surprises here — we’ll revert straight back to our mail carrier analogy. How would an envelope be delivered to the recipient on the front of the envelope? The postal service finds the most logical route to the recipient.

The electronic version of events is handled similarly:
  • The mail server locates the recipient’s server, but since the recipient’s server won’t accept every mail that comes its way, it asks who sent the email.
  • The sending server gives the recipient server information on who the sender is by querying the envelope. Acknowledging the email is from a legitimate source (not spam, etc.), the recipient server says, "sure, I understand that Namecheap exists, and from that sending address.”
  • Satisfied the sender address is correct, the recipient server asks for the receiver’. This is how envelope data is treated. The sending server will now forward the contents of the email contained in the envelope. Once the email has been received, the recipient server gives the mail server a receipt.

Types of MUA



Retrieving email is tasked by a software program called a Mail User Agent (MUA). There are two types of MUA, and these are classed depending on how emails are accessed, via installed software (email client) or through a browser (webmail).

1. When an MUA is installed on a user’s system, it’s called an email client. To use an email client, MUA such as Microsoft Outlook, Mozilla Thunderbird, and Lotus Notes allows users to add the MUA program to their computer. This program is used to download and store email messages to their computers. With a client MUA, emails can be read and written offline.

2. When email is accessed online, it’s called webmail. Web-based MUAs such as Yahoo, Gmail, and Hotmail store messages on their mail servers and can only be accessed through a web page. The main advantage of webmail is sending and receiving mail from a web browser, anywhere. The main disadvantage of using a web-based application is the need to be connected to the internet to use it.

The journey of an email



Let’s break down how an email is transmitted. Like most Internet data, emails travel across the internet as a stream of packets using the internet’s TCP/IP protocol. This process can be broken down into three steps:

1. Once an email is sent, the TCP protocol breaks it down into packets ( ); each packet bears the sender and the email recipient’s address.

2. The IP protocol routes the packets to the intended destination. Routers over the world wide web examine the addresses in each packet to calculate the most efficient route to the email’s destination server. Once a pathway is planned, the packets are forwarded to the next router. Several factors go into how email packets are routed, such as traffic volume on any given network.

3. Once the packets have arrived at the recipient's email server, TCP recombines them into the email format in which it was sent (on that the recipient can read).

How are emails structured?



It might have been a while, but consider how you’d formulate a formal letter you’d take to your mail office or drop in a mailbox. You start by taking pen to paper and writing your name and address on the right-hand side. On the left-hand side, you write the name and address of the intended recipient. Once you’ve written the body of the letter, you place it in an envelope. This is sealed, and the intended recipient's address is written on the front so that the sorting office knows where the letter will be sent. Just in case there is a problem finding the recipient, the sender's address is written on the back.

As technical as email might sound, the letter analogy is the same as how emails are structured. Emails are composed in a mail client (comparable to pen and paper). This is known as MIME data (multipurpose internet mail extensions). The mail server puts the email into an envelope, including the recipient and sender’s addresses (this is called envelope data). Email users won’t come across the envelope since it’s part of an internal process to route an email.

Email envelope, body, and header



An email is constructed with three parts:

1. The envelope that we’ve just mentioned. This is separate from the body and header. Next is the body (that contains the content of the message). Email clients separate an email header and the body (the content text).

2. The body is distinct from the header; it contains everything within the message, including images, text, and other data (such as attachments).

3. The header is arguably the most exciting part of an email’s DNA. The header always precedes the body text. This is logical. When you receive an email, it’s often the header that’s scanned first before the email is opened.

The header includes the mandatory information, including the sender, recipient, and date. Other header lines such as subject and cc are optional. Although only required headers appear to the user, the header includes additional details such as the route the email took as it was transferred from one computer to another. We’ve mentioned the job of Mail Transfer Agents (MTAs). When an MTA forwards an email, it is time-stamped. You’ll notice that some emails that had multiple destinations since the email origination have several received headers. Most of this extra information is hidden inside the email. When viewed in their entirety, they look something like this:




There’s a lot to digest here, but we hope this piece has given you some understanding of just how much goes into the seemingly simple act of sending an email.



Want to do more with email? Our business email setup guide takes you through all the smart options to include from the very beginning when you get a business email address.

Already set up? Our email support page has all you need to configure your email the way you like it.

If you want to work through which email plan is best for you, or even try Namecheap’s Private Email for free for the first two months, you can view our Private email page, or ask our friendly Customer Service Support to help you decide, anytime.
Updated
Viewed
12032 times

Need help? We're always here for you.

notmyip