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.
Comments on this entry are closed.
Very useful article. I’ve been doing a lot of stuff with MX records recently and this finally helps me to connect the dots.
This is one of the best intros to e-mail I’ve read. Thanks!
I looking for it a long time. Thanks.
Useful information.
Great article. Thanks!!!
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!
Thanks,
Very brief and useful article..
Thanks again
Very useful Document…
Very clear and descriptive…..thanks for the article.
Nice Article and easy to understand. Worth while to read.
Very nice explanation, brief, concise, and easy to understand.
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.
thanks you
Thanks for the article. Quick question though, where does the POP/IMAP server reside. Is it managed by the email client?
Thanks, as usual, excellent stuff from geekstuff.
Really good article. Keep up the good work!
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.
Always great pedagogy! Tnx!
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?
@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.
Beautifully explained
Thanks for the article
-Akhilesh
brief and straight to the point ……..thanks
This article I found very useful thank you very much