SEARCH

How-To Geek

HTG Explains: How Does Email Work?

Print

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.

terminal

(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.

Email Map

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

pop v 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.

imap_pop

(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.

Yatri Trivedi is a monk-like geek. When he's not overdosing on meditation and geek news of all kinds, he's hacking and tweaking something, often while mumbling in 4 or 5 other languages.

  • Published 03/15/11

Comments (17)

  1. Hatryst

    Wow… I thought its just a process of signing in, composing a message, sending, and signing out (not to mention reading the mails in the inbox and the spam folder ;) )

  2. Steve

    Thank you, Ray Tomlinson.

  3. Albert G

    Great article! Really well written!

  4. Groff

    Paul Atreides likes your article.

  5. Rasta

    Thanks for sharing

  6. iLLeT

    Thank you.. beneficial article… :D

  7. Hogfather

    Always though I knew this stuff – just goes to show how much we learn from an article like this – great stuff

  8. bill

    Nice understandable article, thanx. Where do I get an SMTP t-shirt??

  9. BeeTco.com

    One billion thanks

  10. Muad'dib

    Muad’dib approves. Muad’dib has spoken. The matter is decided.

  11. Mo s

    Thank you very much, really helpful.

  12. Cheryl

    Love the photo of the old Zenith computer, which I never saw one in 1971. Amazing how far computers have come! Very well written and understandable article.

  13. Andrew

    Did you notice the TECO booklet in the picture with the Zenith terminal? Now *that’s* old-school editing!

  14. caribike

    Thank you very much for your time in writing this article. I had worked out why IMAP was more useful for my needs than POP but not necessarily why.

  15. One World

    “….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….”

    Really??

    I can recall needing to explicitly declare routing in email addresses (using the arcane “!” symbol) as late as the early 80′s.

    Anybody else remember this….or am I the only dinosaur in the group?

  16. Jack

    No, some of us used UUCP for email and news groups back ‘in the day’. … My first home server was really a UUCP node from our local Unix Users Group. That was way before Linus even though of writing his text editor that somehow morphed into Linux! :)

    But even that was in the early 80′s. An yes, we used domain!user routing rather than user@domain routing like we do today (and sometimes some more esoteric routing too).

  17. RealityMasque

    Heya,

    This might be a stupid question, but does the DNS lookup step when sending an email follow the same process as HTTP? I ask as I have a website sending an email via IIS’s SMTP, & where the emails *used* to be received ok, they stopped being able to be received, even though sending to a different destination email address works. I’ve been told that there is an IP address that’s blacklisted that is the problem, while the sending server’s & receiving server’s IPs are fine. If there *is* this blacklisted IP “in the way”, that makes me think the DNS lookup isn’t as straightforward as a “phonebook for the internet”.

    - O8

Enter Your Email Here to Get Access for Free:

Go check your email!