I am going to start this blog with some technical descriptions, because I was asked, and because I think they can be interesting. I will try to keep the descriptions as simple as I can without sacrificing clarity. The first entry will be cover the popular POP3 protocol for receiving mail in an email program.
POP is the Post Office Protocol, and it was designed to work like a real post office box. Incoming mail is placed in the box, and you periodically open the box and remove the mail. I am going describe the simple process, and a typical "leave on server" version, because it helps in understanding what can go wrong, and in understanding the unique features of some implementations.
A basic POP3 session starts with the email program (client) connecting and signing in. The sign-in identifies the user and selects the mailbox. The client will ask for the number and size of the messages, and may ask for each message's unique identifier, if it is available. Each message is downloaded and deleted from the server, and the client signs out. To protect the user from losing messages when the client crashes, if the connection is lost before the client signs out, none of the messages will be deleted, and they will be available in the next session. If the client recorded the unique ids of the messages, they can be deleted without downloading them again, otherwise they will simply be duplicated. (It is better to have two copies than none.)
There are several reasons for leaving messages on the server. The user might want to access the same messages from multiple email programs, or to review the addresses and subject of the messages so that unwanted messages can be deleted without downloading. Some email program also support limiting the size of offline messages, and can download just part of larger messages until they can be reviewed. In any case, this is accomplished by asking the server for the unique ID (UID) of each message and maintaining a list of messages known to be on the server. After deleting or downloading each message, the UID is recorded in the list. (Remember that deleted messages may need to be retained.) In future sessions, the list from the server is compared against the local list. Any messages no longer on the server are removed from the local list, and any messages that are still there, but should have been deleted are deleted again. New messages are identified and processed by the client.
POP3 does not recognise any concept of folders or other organisational features, and it does not contain any commands for controlling the read/unread status of the messages, so email servers that provide both POP3 access and other types of access, like webmail or IMAP, must choose how to handle those details. Most webmail providers only make Inbox messages available through POP3, but some, like Gmail, access everything that is not deleted or Spam.
POP3 is s simple protocol, and is widely supported, but it has some disadvantages. Each email program that accesses the account is an independent mailbox and there is no simple, reliable way to keep them synchronised. There is no required sequence to the UIDs assigned to the messages, so comparing two lists normally starts with sorting, so the process does not scale well to very large mailboxes. It is possible to download part of a message by the number of lines, but it is not possible to download identified parts of a message, like the body or attachments. Also, because it is not synchronised with the server, it is easy for the user to lose track of the messages that were left behind.
No comments:
Post a Comment