System Model and Philosophy
Electronic mail is a primary means of communication for the widely spread SUMEX-AIM community. The advent of distributed workstations is forcing a significant rethinking of the mechanisms employed to manage such mail. With mainframes, each user tends to receive and process mail at the computer he used most of the time, his "primary host". The first inclination of many users when an independent workstation is placed in front of them is to begin receiving mail at the workstation, and, in fact, many vendors have implemented facilities to do this. However, this approach has several disadvantages:
-
Workstations (especially Lisp workstations) have a software design that gives full control of all aspects of the system to the user at the console. As a result, background tasks, like receiving mail, could well be kept from running for long periods of time either because the user is asking to use all of the machine's resources, or because, in the course of working, the user has (perhaps accidentally) manipulated the environment in such a way as to prevent mail reception. This could lead to repeated failed delivery attempts by outside agents.
-
The hardware failure of a single workstation could keep its user "off the air" for a considerable time, since repair of individual workstation units might be delayed. Given the growing number of workstations spread throughout office environments, quick repair would not be assured, whereas a centralized mainframe is generally repaired very soon after failure.
-
It is more difficult to keep track of mailing addresses when each person is associated with a distinct machine. Consider the difficulty in keeping track of a large number of postal addresses or phone numbers, particularly if there was no single address or phone number for an organization through which you could reach any person in that organization. Traditionally, electronic mail on the ARPANET involved remembering a name and one of several "hosts" (machines) whose name reflected the organization in which the individual worked. This was suitable at a time when most organizations had only one central host. It is less satisfactory today unless the concept of a host is changed to refer to an organizational entity and not a particular machine.
-
It is very difficult to keep a multitude of heterogeneous workstations working properly with complex mailing protocols, making it difficult to move forward as progress is made in electronic communication and as new standards emerge. Each system has to worry about receiving incoming mail, routing and delivering outgoing mail, formatting, storing, and providing for the stability of mailboxes over a variety of possible filing and mailing protocols.
Consequently, while the workstation may be viewed as an Internet host in the sense that it implements IP, it should not be viewed as the entity which contains the user's mailbox. Rather, a mail server machine (sometimes called a "repository") should hold the mailbox, and the workstation (hereafter referred to as a "client") should access the mailbox via mail transactions. Because the mail server machine would be isolated from direct user manipulation, it could achieve high software reliability easily, and, as a shared resource, it could achieve high hardware reliability, perhaps through redundancy. The mail server could be used from arbitrary locations, allowing users to read mail across campus, town, or country using more and more commonly available clients. Furthermore, the same user may access his mailbox from different clients at different times, and multiple users may access the same mailbox simultaneously.
The mail server acts an an interface among users, data storage, and other mailers. The mail access protocol is used to retrieve messages, access and change properties of messages, and manage mailboxes. This differs from some approaches (e.g., Unix mail via NFS) in that the mail access protocol is used for all message manipulations, isolating the user and the client from all knowledge of how the data storage is used. This means that the mail server can utilize the data storage in whatever way is most efficient to organize the mail in that particular environment, without having to worry about storage representation compatibility across different machines.
In defining a mail access protocol, it is important to keep in mind that the client and server form a macrosystem, in which it should be possible to exploit the strong points of both while compensating for each other's weaknesses. Furthermore, it's desirable to allow for a growth path beyond the hoary text-only RFC 822 protocol. Unlike POP2, IMAP3 has extensive features for remote searching and parsing of messages on the server. For example, a free text search (optionally in conjunction with other searching) can be made throughout the entire mailbox by the server and the results made available to the client without the client having to transfer the entire mailbox and searching itself. Since remote parsing of a message into a structured (and standard format) "envelope" is available, a client can display envelope information and implement commands such as REPLY without having any understanding of how to parse RFC 822, etc., headers.
Additionally, IMAP3 offers several facilities for managing a mailbox beyond the simple "delete message" functionality of POP2.
In spite of this, IMAP3 is a relatively simple protocol. Although servers should implement the full set of IMAP3 functions, a simple client can be written which uses IMAP3 in much the way as a POP2 client.
IMAP3 differs from the DMSP protocol of PCMAIL (RFC 1056) in a more fundamental manner, reflecting the differing architectures of IMAP and PCMAIL. PCMAIL is either an online ("interactive mode"), or offline ("batch mode") system. IMAP is primarily an online system in which real-time and simultaneous mail access were considered important.
In PCMAIL, there is a long-term client/server relationship in which some mailbox state is preserved on the client. There is a registration of clients used by a particular user, and the client keeps a set of "descriptors" for each message which summarize the message. The server and client synchronize their states when the DMSP connection starts up, and, if a client has not accessed the server for a while, the client does a complete reset (reload) of its state from the server.
In IMAP, the client/server relationship lasts only for the duration of the IMAP3 connection. All mailbox state is maintained on the server. There is no registration of clients. The function of a descriptor is handled by a structured representation of the message "envelope". This structure makes it unnecessary for a client to know anything about RFC 822 parsing. There is no synchronization since the client does not remember state between IMAP3 connections. This is not a problem since in general the client never needs the entire state of the mailbox in a single session, therefore there isn't much overhead in fetching the state information that is needed as it is needed.
There are also some functional differences between IMAP3 and DMSP. DMSP has functions for sending messages, printing messages, and changing passwords, all of which are done outside of IMAP3. DMSP has 16 binary flags of which 8 are defined by the system. IMAP has flag names; there are currently 5 defined system flag names and a facility for some number (29 in the current implementations) of user flag names. IMAP3 has a sophisticated message search facility in the server to identify interesting messages based on dates, addresses, flag status, or textual contents without compelling the client to fetch this data for every message.
It was felt that maintaining state on the client is advantageous only in those cases where the client is only used by a single user, or if there is some means on the client to restrict access to another user's data. It can be a serious disadvantage in an environment in which multiple users routinely use the same client, the same user routinely uses different clients, and where there are no access restrictions on the client. It was also observed that most user mail access is to a relatively small set of "interesting" messages, which were either "new" mail or mail based upon some user-selected criteria. Consequently, IMAP3 was designed to easily identify those "interesting" messages so that the client could fetch the state of those messages and not those that were not "interesting".
One crucial philosophical difference between IMAP and other common mail protocols is that IMAP is a mailbox access protocol, not a protocol for manipulating mail files. In the IMAP model, unlike other mail system models in which mail is stored in a linear mail file, no specification is made for the implementation architecture for mail storage. Servers may choose to implement mailboxes as files but this is a detail of which the client can be totally unaware.
What is more, in the IMAP model, mailboxes are viewed as mappings from keys into values. There are broadly three types of keys, generic, canonical and concrete. Generic keys are generic, mail protocol independent keys defined by IMAP which are meaningful across multiple mail encoding formats. An example of such a generic key might be "TO", which would be associated with the "To:" field of an RFC 822 format message.
Canonical keys represent the way in which the server can associate values that are generally "about" a certain key concept, possibly integrating several mail format specific fields, without having to worry the client with the particular details of any particular message format. Thus, the canonical TO key (called $TO) could denote anything that could reasonably be construed as being directed towards someone. Hence, in an RFC 822 message the server could find the union of the "To:", "Resent-To", "Apparently-To:" and "CC:" fields to be the appropriate value associated with the canonical $TO key.
Concrete keys allow the client to gain access to certain mail format specific concepts, that are not pre-specified by the IMAP protocol, in a well defined manner. For example, If the client asks for the value associated with the "APPARENTLY-TO" key then, if the message were to be in RFC 822 format, the server would look for a header field called "Apparently-To:". If no such field is found or the field is not implemented or meaningful for the particular message format then the server will respond with the null value, called NIL, indicating the non-existence of the field.
Thus, IMAP servers are at liberty to implement mailboxes as a relational databases if it seems convenient. Indeed, we anticipate that future mail systems will tend to use database technology for the storage and indexing of mailboxes as a result of the pressure caused by the increasing size of mailboxes.
Although for historical reasons IMAP is currently somewhat closely associated with RFC 822, we anticipate that future developments in IMAP will remove these mail format specific components and will move towards the generic model mentioned above. This will allow IMAP more easily to incorporate such things as multi-media mail.