You send and receive it everyday, it’s instantaneous, and it doesn’t cost a thing. It’s email, one of the most important tools of today. Let’s take a look at how it works, under-the-hood and in normal language.

What Exactly Is Email?

Electronic mail (abbreviated as e-mail, email, E-Mail, etc.) is a very old form of computer-based communication. A long time ago – in technological, not human, terms – computers were giant machines. People used dial-up terminals to access them, and each machine held storage for multiple users. As is the case with any community, people found useful and unique ways to communicate with one another, and a messaging system evolved. The caveat was that you could only send messages to other users on the same system, at least up until 1971. As the story goes, along came Ray Tomlinson who sent the first email by addressing a user on another system using the ‘@’ symbol. Obviously, both the underlying dynamics and far-reaching consequences weren’t so simple, but it was that notion that brings us to where we are today.

(Image from ajmexico)

Email was, at that time, the equivalent of today’s text message. Over time, it changed and evolved like anything else; it has sender and receiver info, a subject line, a message body, and attachments, but on the whole, emails are pretty simple documents. It’s not so easy to get it from point A to point B, however. Like anything else, there’s an intricate process involved that works behind the scenes to make it seem as seamless as possible. A lot of the ideas used in relaying email were important in formulating document transfer, which is at the core of things like bulletin board systems and the world wide web.

From Sender to Recipient

Let’s start with an illustration of the process. It may not make complete sense at first, but it’ll be useful to refer back to.

When someone, let’s say a spice seller, sends an email, it has to have an address in the form of user@domain.ext. Our example has freman.alpha@arrakis.com. The email gets sent by the client to an outgoing mail server via Simple Mail Transfer Protocol. The SMTP server is like your local post office, which checks your postage and address and figures out where to send your mail. It doesn’t understand domains, though. They’re a sort of abstract thing, so the SMTP server contacts a Domain Name System server. The DNS server is a sort of phone or address book for the internet; it translates domains like “arrakis.com” to an IP address like “74.238.23.45.” Then, it finds out if that domain has any “MX” or mail exchange servers on it and makes a note of it. This is like your post office consulting maps of where your mail is supposed to go, calling their local post office, and checking to see if your friend has a mailbox or P.O. box to receive mail.

Now that the SMTP server has the proper info, the message gets sent from that server to the target domain’s mail exchange server. This server is referred to as an MTA, or Mail Transfer Agent. It decides where exactly to put the mail, much like how your friend’s post office figures out how best to get it delivered. Then, your friend goes and fetches the mail, usually using a client that works via POP or IMAP.

POP vs. IMAP

These two acronyms plague email settings panels everywhere, so let’s take a deeper look at them. POP stands for Post Office Protocol. It’s useful because, like a post office, you can pop in, grab all of your mail, and then leave. You don’t need to stay connected, and aside from leaving a copy on the server, it’s a pretty cut-and-dry procedure. If you don’t leave a copy on the server, it doesn’t require much space or bandwidth either. You can use POP to grab mail from several different inboxes on several different email servers and consolidate them on one.

It has its drawbacks, though. POP is a unidirectional protocol; information travels one way. Once you download the email to a client, it’s up to the client to sort through its different statuses and so on. That’s fine if you only ever access mail from one place. Nowadays, though, it’s common to get email access from your phone’s client, the web interface when you’re away somewhere, and a client when you’re at home. It’d be tedious to sort through all of that info over several devices, assuming you’ve even kept a copy of each email on the server to begin with.

(Image from SuccessByDesigns)

IMAP’s a bit smarter about things. While POP can be considered to be very “client-oriented,” the Internet Message Access Protocol was designed to work in a different way: it’s “server-oriented,” and bi-directional. Clients have a two-way communication with their servers. All messages are kept on the server so multiple clients can access them. When you check an email on your phone, it’s marked as read and during the next interaction with the server, that status is sent back so all other clients can be updated with it. It’s like having your mail sent to an assistant at the post office who categorizes it and stores it for you, gives it to you whether you’re at home, at work, or actually there, and makes changes to the stored copies as you do.

You can keep a properly marked archive on your home client as well as on your mail server. IMAP also supports an offline mode; changes are synched with the server the next time you’re online. You can configure IMAP mail servers to fetch mail from POP inboxes, too, which works really well if you’re looking to consolidate. Of course, since IMAP works with the “cloud” ideal, server access and storage can be issues. Thankfully, storage space and bandwidth isn’t as expensive as it used to be, but this can definitely be a trade-off for some people.

Both SMTP and MTA

Unlike your physical mailbox, your outgoing and incoming mail are handled by two different types of servers. There’s really no discrimination towards receiving servers; any computer can be made an MTA pretty easily and handle things well. Sending mail is a different story. SMTP servers must have static IP addresses, and most ISPs block port 25 so that their users can’t send mail themselves. Why? Because of the massive amounts of spam gnawing away at our collective bandwidth, the very stuff your MTA should be configured to filter out. You can configure your clients to use your ISP’s SMTP server in lieu of running your own. The point is that you need both an MTA and an SMTP server to use email, as each is specialized for what it does.

Email’s an important part of our everyday lives, but it’s nice to understand just how it works. After all, we wouldn’t have the internet without it.