Post Office Protocol (POP) fundamentals
Tags: protocolstandards, learning, webdev, beginners
Published: 2023-06-25 15:16:48

Hello, I'm Aravind, and I work at Luxoft as a junior software developer. I've tried to give a concise introduction of the Post Office Protocol (POP) in this post. One of my areas of interest in protocol standards is this. The fundamental article on the Post Office Protocol is available here.

**Introduction:**
POP is an email protocol utilised to retrieve emails form a server and send them to an email application client. Since its introduction in 1984, it has become one of the largest and most widely used mailbox access protocols. POP is an OSI model application layer technique that enables end users to access and receive email. Compared to other mailbox accessing protocols, it is easier to establish, run, and maintain. POP employs the Simple Mail Transfer Protocol (SMTP) for end-to-end email exchange and the TCP/IP protocol stack for network connections. POP gets any new messages from the server, whereas SMTP sends emails to the distant server.

**Features:**
1. POP uses port 110.

2. It employs a Persistent TCP connection.

3. This is a type of pull protocol

4. It is a connection-oriented protocol

5. The POP protocol is a stateful protocol while downloading mail, later it is a stateless protocol.

**Working:**
When it comes to email communication, your freshly received messages are securely stored on a remote server. To access these emails, your device's email client, whether it's a Mac, PC, phone, tablet, or any other device, establishes communication with the server. Through this connection, your client retrieves all the new messages, allowing you to read and manage them conveniently.

The longevity of these messages on the server depends on your device software's configuration. . You have the option to specify whether they should be deleted right away after retrieval, retained on the server for a set amount of time, or both. Typically, mails are finally deleted from the server in order to maximise server capacity and maintain effective management of emails.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3os95gx70v29p3biuh58.jpg)

It's important to remember that the Post Office Protocol (POP)'s main function is to make it easier for messages to be downloaded to your device from the server rather than sent. Your device uses the Simple Mail Transfer Protocol (SMTP), which manages the transmission of outgoing emails, for the latter duty. This allows for smooth and all-inclusive email communication that includes both incoming and outgoing messages thanks to the combination of POP and SMTP.


**Difference between POP and IMAP:**
IMAP (Internet Message Access Protocol) is an alternative equivalent technology to POP for getting new emails from a distant server. While IMAP is progressively gaining ground and replacing POP as many Email Service Providers (ESPs)' preferred choice, POP still functions as a more fundamental protocol.

IMAP functions differently from POP in that it syncs every email folder you have, making sure that the information on your devices matches what is kept on the server. As a result, any actions taken on one device—for example, removing six messages from your phone—will also have an impact on the computer and any other synchronised devices. By enabling this synchronisation feature, IMAP saves users important time by removing the need to conduct the same updates across multiple computers and gadgets.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7e5wjbhpqoegr2lxjgjm.jpg)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l86sdo6cjkaivphl00ya.jpg)

**Versions of POP:**

The term "POP" may conjure up images of music, musical culture, & the long list of musicians and ensembles that have influenced the genre over the years, but in the context of this debate, it refers to something very different.

POP1, the first iteration of the Post Office Protocol, was released in the year 1984. Its goal was to offer a quick and effective way to get emails off a server. The Internet's Engineering Task Force outlined the protocol in a Request of Comments (RFC 918) document. POP1's primary goal was to allow users to access their messages without being constantly connected to the server online.

Two more iterations of the protocol, POP2 & POP3, came out in relatively quick succession, during 1985 & 1988, respectively. Despite going through several changes since its first release, POP3 has continued to stick to the fundamental ideals of simplicity and effectiveness.

The Post Office Protocol does not directly relate to music or the dynamic cultural environment of artists and bands, despite the fact that they share the same acronym. Instead, it is an important piece of technology that has influenced how we access and handle our emails by providing offline access and speedy retrieval procedures.

Simple code: POP3 is a standard protocol.
```
S: <wait for connection on TCP port 110> 
C: <open connection> S: +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us> 
C: APOP mrose c4c9334bac560ecc979e58001b3e22fb 
S: +OK mrose's maildrop has 2 messages (320 octets) 
C: STAT S: +OK 2 320 C: LIST 
S: +OK 2 messages (320 octets) 
S: 1 120 S: 2 200 
S: . 
C: RETR 1 
S: +OK 120 octets 
S: <the POP3 server sends message 1> 
S: . 
C: DELE 1 
S: +OK message 1 deleted 
C: RETR 2 
S: +OK 200 octets 
S: <the POP3 server sends message 2> 
S: . 
C: DELE 2 
S: +OK message 2 deleted 
C: QUIT 
S: +OK dewey POP3 server signing off (maildrop empty) 
C: <close connection> 
S: <wait for next connection>
```
where: S means Server & C means Client.

**Advantages:**
1. Users can access their emails even when they are not online thanks to it. All that is necessary for downloading emails from the server is an internet connection. The emails are stored on our PC or hard drive after being downloaded from the server, where they may be read without an internet connection. We could draw the conclusion that the POP3 protocol does not require constant internet access as a result.
2. The amount of email we can send or receive has no size restriction.
3. It is one of the most often utilized protocols in use today since it is a straightforward protocol.
4. Since all emails are kept locally, less server storage space is needed.

**Disadvantages:**
1. Emails are immediately deleted from the server when they are retrieved from it. As a result, mails cannot be viewed from other computers unless additional workstations are configured to leave a copy of the message on the server.
2. Since the emails are stored locally, anyone using your computer may access the email folder.
3. All of the attachments are kept on your local system, therefore if they aren't screened for viruses before being opened, there is a big risk of malware assault.

**Conclusion:**
An essential method for sending emails from servers to clients is the Post Office Protocol (POP). Users may easily retrieve messages from the server to their devices using POP and SMTP together. While POP provides ease and offline access, it has drawbacks including the ability to immediately delete emails from the server. It has nothing to do with music. The most often used variant is POP3. IMAP offers a different option, focusing on device synchronisation. Efficient email management and communication are made possible via POP and IMAP. User preferences will determine which one is selected.