≡ Menu

How Email Works? – Email Basic Concepts Explained

From an email client, you’ll typically compose a message, attach any necessary files, and send it to the recipient. But, have you wondered what happens behind the scenes? How the email is sent from your outbox to the recipients inbox?

In this article, we will explain the basis of email. For those who already know this stuff, this might be a quick refresher.

What is an Email?

Till 1971, people were able to send messages to other people working on same system only. In 1971, the first e-mail message was sent by Ray Tomlinson. Though that was a very simple message based communication but it formed the basis of how advanced e-mails have become today.

The main components of an e-mail system that facilitate sending and receiving of e-mails on Internet are :

  • An e-mail client
  • An e-mail server (SMTP server)
  • POP and IMAP servers.

Lets study these and then finally try to connect the dots to understand the complete system.

An Email Client

If you use e-mails for online communication the you would definitely be using  an e-mail client. An e-mail client provides you with the following capabilities :

  • Provides a list of messages that people have sent to you. Each entry in the list contains the name of sender, a subject, a few words from the message body and the time/date on which it was received.
  • Provides the ability to read a complete message, reply to it or forward it to other people.
  • Provides the ability to compose a new message and send it to the desired recipients.
  • Delete a message.

The e-mail clients could be standalone (like Microsoft Outlook, Pegasus etc) or could be web based (like gmail, yahoo etc). There could be many advanced abilities that e-mail clients may provide but whatever the type of e-mail client be, the core abilities described above are provided by all type of clients.

An Email Server

Whenever you send a message from your e-mail client, it goes to an e-mail server. The e-mail server manages the messages received by it. It forwards the message to a POP or IMAP service if the message is to be sent to a recipient on the same subnet else it follows the standard procedure to send the message over Internet to the destined person.

An e-mail server comes into the picture twice if e-mail is sent over Internet to a remote destination. First it’s the sender’s e-mail server that sends the e-mail over the Internet and second is the receiver’s e-mail server that receives the e-mail and makes sure that it is delivered to the recipient’s system. On the other hand, an E-mail server comes into picture only once when the recipient is on the same subnet.

SMTP servers are widely used as e-mail servers all over the internet. An SMTP server is also known as Mail Transfer Agent (MTA).

You also may want to read Journey of a Data Packet in Internet, which explains how packets traverse on Internet.

POP and IMAP Servers

As already explained, these servers come into the picture when a message is received by SMTP server and it needs to be forwarded to the actual recipient. Let’s discuss both these servers one by one :

POP

POP stands for Post Office Protocol. A POP (or POP3) server in it’s simplest form stores the messages for a particular user in a text file. The file for a particular user is appended with information each time an e-mail is received by a POP server.  If your e-mail client is configured to use a POP3 protocol then whenever you try to fetch e-mails through your e-mail client then a request is sent to your POP server for the same.

A POP server requires the log-in credentials of a user that are sent through e-mail client. Once a user is authenticated, the POP server provides access to user’s e-mails.  As with any client server architecture, the e-mail client interacts with the POP server through a predefined set of commands.

Here is a list of common commands used to interact with POP server :

  • USER  – For User-ID
  • PASS   – For Password
  • LIST   – Provide message list
  • DELE – To delete a message
  • QUIT  – To end the interaction

Please note that the e-mail client connects to port 110 on the server where POP service is running. After connecting the e-mail client issues the commands (as described above) to the POP server to authenticate, fetch e-mail, list e-mails etc.

One small problem with POP servers is that once an e-mail client fetches the e-mails from this server on client machine, it gets difficult to access the same e-mails from any other device or system as they get downloaded on client machine and are removed from the server.  Though there exists and option ‘Keep a copy on server’ through which e-mail clients can tell the server not to delete the e-mails. But, this leads to multiple copies of your mailbox on clients as well as on server and so it makes the management of e-mails difficult.

IMAP

IMAP stands for Internet message access protocol. This protocol is also used to access e-mails but it is far more capable than POP. One of the most prominent feature an IMAP server provides is the central access to e-mails. Unlike POP server, an IMAP server keeps the e-mails on the server itself and so you can access e-mails from any machine or device.

This server also provides easy management of e-mails like searching, categorizing the e-mails and placing them into various sub-folders etc. The only problem that one could imagine with IMAP server is that you always need an Internet connection so that the e-mail client is able to fetch e-mails from the IMAP server. But today, almost all of the e-mail clients have the capability to cache the e-mails so that you can even view them when you are offline.

To interact with IMAP server, the e-mail client connects to server machine on port 143. As with POP, IMAP server also understands a set of commands which the e-mail client uses to connect with the server.

Connecting the Dots

With the understanding of all the major components used in e-mail system, lets connect the dots and understand how the whole e-mail system works:

  • An e-mail client like Gmail, yahoo, outlook etc is used to create or reply to an e-mail.
  • Once the e-mail is drafted successfully, it is sent using the e-mail client.
  • This e-mail first goes to the SMTP server (also known as MTA (Mail transfer agent) ) to which the e-mail client is connected.
  • The e-mail server looks out for the recipients address. The address is of the form <name>@domain.com
  • The e-mail server first uses the DNS technique to resolve the domain name into a valid IP address.
  • Next it sends the e-mail to to this IP address over the Internet.
  • Now the e-mail traverses over the Internet in a series of IP packets and reaches the destination SMTP server or the MTA.
  • This server collects all the e-mails and places them to appropriate location so that these are accessible to your e-mail clients through POP or IMAP services.

There you have it. That is how e-mail system works.

Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Ifiok Jr. May 14, 2013, 8:25 am

    Very useful article. I’ve been doing a lot of stuff with MX records recently and this finally helps me to connect the dots.

  • JackRabbit May 14, 2013, 8:53 am

    This is one of the best intros to e-mail I’ve read. Thanks!

  • Raniere May 14, 2013, 10:01 am

    I looking for it a long time. Thanks.

  • Tri May 14, 2013, 10:20 am

    Useful information.

  • bob May 14, 2013, 10:25 am

    Great article. Thanks!!!

  • Mike Jolly May 14, 2013, 11:59 am

    A few points of clarification / notes:

    1) You used the word “subnet” a couple times in the e-mail server section of your post… I don’t think I like that word for what you might have been trying to convey 😉

    Maybe you meant “e-mail ‘domain’ (not to be confused with ‘dns domain’)” or “e-mail infrastructure”. Of course, even that’s not super accurate, as mail servers in the same “infrastructure” or “[loosely defined] domain” may talk amongst themselves using SMTP.

    2) It might be worth mentioning POP3S/IMAPS and their associated ports since you mention POP3/IMAP. I’m amazed at the number of people (and service providers) that are perfectly fine using (and sometimes allowing _only_) clear text protocols.

    It’s probably not the place for discussing it, but a number of people are used to the “interaction” of their mail clients with POP services. When I try to move people to IMAP, they’re generally in MS outlook, and outlook does a pretty horrid job of implementing PURGE and MOVE (or whatever it may be) for certain IMAP servers. That’s generally the time that I point out how little a hosted exchange box can cost nowadays 😉

    3) The MTA doesn’t “resolve the domain name into a valid IP address” per se… It resolves the IP address of the MX record for the domain name.

    Thanks for writeups like this! I definitely enjoy ’em!

  • Jalal Hajigholamali May 14, 2013, 9:21 pm

    Thanks,

    Very brief and useful article..

    Thanks again

  • Md Aftab May 15, 2013, 3:44 am

    Very useful Document…

  • Biswajit Sahoo May 15, 2013, 6:38 am

    Very clear and descriptive…..thanks for the article.

  • Srinivas Jupudi May 15, 2013, 7:08 am

    Nice Article and easy to understand. Worth while to read.

  • chapuzzo May 17, 2013, 2:19 am

    Very nice explanation, brief, concise, and easy to understand.

  • vinod May 18, 2013, 9:44 pm

    Good article…easy to understand…thank you Sir..

    i am visiting this site every day to learn new things in easy way …I appreciate the level of knowledge you are sharing trough this site. Thanks a lot again.

  • Jing May 18, 2013, 11:02 pm

    thanks you

  • Bori May 20, 2013, 7:43 pm

    Thanks for the article. Quick question though, where does the POP/IMAP server reside. Is it managed by the email client?

  • SureshG May 28, 2013, 11:56 pm

    Thanks, as usual, excellent stuff from geekstuff.

  • Suren May 31, 2013, 1:07 am

    Really good article. Keep up the good work!

  • Jose Benito May 31, 2013, 8:48 am

    Your explication is very technican, but can begin with describe the problem for explain the solution, because don’t understand the reason of each component, only explain those. Thanks.

  • cyanide June 4, 2013, 2:31 pm

    Always great pedagogy! Tnx!

  • Sam June 13, 2013, 5:28 am

    But I still think you need one more IMAP/POP3 server object in front of the first Email Mail Client (in reference to the diagram) since it also received messages sent from the other.

    Am I right or wrong?

  • Mike Jolly June 14, 2013, 8:50 am

    @Sam — I think the diagram’s showing the one way flow that a message takes as it goes through the delivery process. The first client sends mail via SMTP to its MTA. Which is to say, in your mail client (whether POP3(s) or IMAP(s)), you still configure an SMTP server for outbound mail.

    If he didn’t have the little arrows on the lines that implied the directionality of the mail conversation, I’d agree with you 😉 Of course, making sure to note that your incoming mail server and outgoing mail server aren’t necessarily the same host.

  • Anonymous July 21, 2014, 6:25 am

    Beautifully explained

    Thanks for the article

    -Akhilesh

  • roilex December 3, 2015, 5:05 am

    brief and straight to the point ……..thanks

  • Prasad June 19, 2017, 11:43 pm

    This article I found very useful thank you very much