How Does an Email Server Work

How Does an Email Server Work

Email or electronic mail is the way in which the world communicates today. It is the fastest form of text communication, over large distances. Have you ever wondered how an email server works? How is sending and receiving mail possible? Read to know all about it.
Could we netizens imagine a life without email? Though it is a novelty for the older generation, the younger one hardly uses any other form of communication. This is because email is probably the fastest way to communicate.

Though nothing can be compared with the beauty of a handwritten letter, speed matters and that is what makes email more popular. This type of communication has reduced the use and waste of paper. It is easier to maintain correspondence. Businesses all over the world are switching over to email communication and thus, they have indirectly changed the pace of business processes.

Most of the technologies, like email, are taken for granted. One never thinks about how this technology actually works. The email system was in use, even before the Internet was made operational. The first mail system was developed for the ARPANET, which was a defense-related internal network of the US government. The first modern type of email that resembled today's mail was sent in 1971. Today, millions of emails are sent every second. How is the journey of your text message, typed from your personal computer to a distant friend, thousands of kilometers away, made possible? Let us understand how your email makes this journey through routing stations called email servers.

How it Works

Everything that happens on the Internet is through client/server communication. A client is any computer connected to the Internet through a unique IP address. A server is another computer connected to the Internet and does the task of hosting and serving web pages and makes the email system work. Servers are computer programs that run on high-speed machines. These machines are designed to handle the requests of millions of clients at a time, who access a webpage or email service which they are using on their machine. In simple words, this process is known as web hosting.

An email system is made to work by two types of servers. One is the SMTP server and other is the POP3 or IMAP sever. Many of us normally use a mail client software like Microsoft Outlook or the latest Mozilla Thunderbird that downloads the incoming email on your machine, from the mail server of the particular email account you use, on sites like Gmail or Yahoo. Let us understand how it all works in terms of client/server communication.

SMTP Server

SMTP stands for 'Simple Mail Transfer Protocol'. A protocol is an algorithm or communication procedure, for a particular purpose. This server program exclusively handles the sending part of a mail. When you log into your mail account through a client like Outlook Express or access it directly through a site like Hotmail, your client computer communicates with the SMTP server of your email site. An email ID is by default in the following format: 'username@mailsite.com'.

The SMTP server receives the sent mail through port 25. Different ports of a server machine are assigned for certain specific tasks. Then, this server separates the user name and the site name. If the site name is same as the mail site from which it is sent, then it forwards the mail to its POP3 or IMAP server, which handles incoming mail. For example, if I am sending the mail from my Gmail account and the recipient's address is also a Gmail account, then the SMTP server will simply forward the mail to the POP3 or IMAP Gmail server.

If, on the other hand, the sent email ID belongs to a different site like Yahoomail, then the Gmail SMTP server will contact the DNS (Domain name server) and ask for the IP addresses of the yahoomail server and forward the mail to the Yahoomail SMTP server. A mail is a text file which is then forwarded by the Yahoomail SMTP server to its POP3 or IMAP server. This server stores it into a particular file, dedicated to the recipient's mail account.

Often, the SMTP server cannot locate the IP address of the mail recipient server. In such cases, the sent mail is queued and periodically sent again. In case it's not able to send the mail, the server generates a 'mailer daemon' message, which informs the sender of failure in message delivery and the reasons for it.

POP3 and IMAP Server

The POP3 server handles the other end of the emailing job. POP stands for 'Post Office protocol'. Through the server port 110, the POP3 server receives your request for reading mail, after you log in. Gmail's POP3 server maintains a detailed text file for every account that is registered on it. All the mail messages delivered through SMTP server communication are pasted in that text file, one after the other, along with all the required delivery timing and other details. When you want to read the mail, it analyzes the text file and separates each mail by header, subject, and sender's name and serves it on your machine. The only disadvantage of a POP3 server is that once you download all your incoming messages through a mail client, they do not remain on the server machine. That is, they are erased from there.

The IMAP (Internet Message Access Protocol) server is an improvement of the POP3 server and takes care of the only disadvantage it has. It maintains the original copy of your incoming mail as a text file on the server, even after you download it. So with an IMAP server, you can access your mail from any machine and download the mails on the machine or read them live on the site itself, without downloading.

Email Attachments
Attachments are extra files attached to the mail, which may or may not be text files. The attachments are sent through a mail by encoding their content into another text format and pasting them in the mail itself. These days, Multipurpose Internet Email Extensions (MIME) allow audio and video file attachments.

Thus, the working of an email system is quite simple in principle. The servers handle millions of such requests from all over the world, every minute. It's the most advanced automatic mailing system in the world.