IMAP works by accessing email messages stored on a email server, rather than downloading them to a local device like POP3. When a user opens an email client using IMAP, it connects to the server and requests a list of available messages. The server provides the client with a list of message headers, which allows the client to quickly browse through the messages without actually downloading them.
When a user opens a specific message, the email client requests that the server download the full message content. The client can also perform various actions on the messages, such as deleting, moving, or marking read/unread, and these changes are synchronized back to the email server. Overall, IMAP allows for remote access to a full range of email functions, including the ability to access emails from multiple devices or web browsers while maintaining synchronization across all of them.