Email is one of the primary services running on the internet. So, what application, protocol and services are required for email? The email server stores email messages in a database. The email is using the store-and-forward method for sending and storing the messages.
The clients of email communication with the servers running mail services to send and receive an email. The client connected server communicates with other mail servers to transport messages from one domain to another. The client does not communicate directly with another email client when sending an email. But, both mail clients rely on the mail server to transport messages.
The Email process uses three types of protocols:- Simple Mail Transfer Protocol (SMTP), Post Office Protocol (POP), and Internet Messaging Access Protocol (IMAP). The application layer process that sends mail uses SMTP. But a client retrieves email using POP or IMAP.
Simple Mail Transfer Protocol (SMTP) Operation
The SMTP message formats required a message body with the message header. The body of the message can hold any amount of text; the message header must have a properly formatted recipient email address and a sender address.
When a client sends an email message, the client SMTP process connects with a server SMTP process on port 25. When the client and server set up a connection, then the client tries to send the email message to the server. After the server receives the email message, it either places the message in a local account in case of the local recipient or forwards the message to another mail server for delivery.
If the destination email server is busy or not online then the SMTP spools message to be sent at the later time. The server checks for the queue periodically and attempts to send them again. when the message expiration time is over and it is still in the queue. Then the message is returned to the sender as an undeliverable message.
The figure above illustrates the technique of message sending. The client sends an email message to firstname.lastname@example.org. The SMTP / POP server-1 will receive the message. Server-1 will check the recipient’s list of local recipients. If found the message will be placed on the local account, if not found, the message will be forwarded to SMTP / POP server-2.
Post Office Protocol (POP) Operation
The POP server passively listening on TCP port 110 for client connection requests. When a client needs to make use of the POP service; it sends a request to start a TCP connection with the server. On establishing a connection the POP server sends a welcome to the client.
When client and POP server set up a connection. Both exchange commands and responses until the connection terminations. With POP, when client download email messages than the server remove these messages.
The POP server has the temporary holding area for mail till download to the clients. Because there is no central place for email messages storage. Because of no centralized storage for email messages; it is no an attractive choice for a small business that needs centralized storage for backup.
Internet Messaging Access Protocol (IMAP) Operation
The Internet Message Access Protocol (commonly known as IMAP is another protocol that describes a technique to retrieve email messages from the remote mail server. An IMAP server usually listens on port 143 and IMAP over SSL is assigned port number 993. Unlike POP, when the user connects to an IMAP- server, copies of the mail are downloaded to the client application.
The original messages are held in reserve on the server until the user explicitly deletes them. Users view copies of the messages in their email client software.
The server stores Incoming email messages in the recipient’s email box. The user retrieves the messages with an email client that uses one of a number of email retrieval protocols. The majority of clients support the standard protocols, SMTP for sending an e-mail message, POP and IMAP for retrieving email.
The IMAP client can make a file hierarchy on the server to organize and store emails. When a user wants to delete a mail; the server synchronizes that command and deletes the message from the mail server.