Avoiding the slow and error-prone process of manually entering an email address in the message composition window's To: and Cc: fields is something that most email applications attempt to do. One popular method is to prepare an address book and to allow users to select addresses from it by some means; this is effective, and works particularly well in a structured environment where someone is responsible for keeping a shared address book up to date. It works less well in an informal environment such as a personal computer where the effort to maintain an address book is not invested; in many cases users simply scan their mailboxes for the last message they received from a correspondent and reply to it.

Auto-completion, including command-line tab-completion and GUI suggestions menus, is another effective method of making input quicker, more convenient and less error prone. Auto-completing email addresses in message composition is an attractive idea, but it requires an automatically-maintained set of possible completions. A thin IMAP email application like Decimail Webmail simply doesn't have the local state required to compute suggested completions: it may have seen only a handful of email addresses in the messages that you've read in this session, which doesn't help if you want to write to someone who you last heard from a year ago.

On the other hand, the IMAP server does have the necessary state. Given a completion starting point, e.g. "John S" it can search all of your old messages for matching email addresses and find "John Smith <>". (Being able to perform this search quickly enough to be useful is another matter, and is where using a proper database as Decimail Server does is a definite help.) So the solution is to add an extension to the IMAP protocol by which the client can ask the server for completions. I have defined such an extension which is now supported by Decimail Webmail and Decimail Server, and I hope that it could be supported by other email applications in due course; I'll write it up as an RFC if there is any interest.

The extension is called XCOMPLETE, and that token is now returned by Decimail Server in its CAPABILITIES response. When the extension is present the client can issue the XCOMPLETE command which has the following syntax:

tag XCOMPLETE maxitems header_name pattern

maxitems is the maximum number of completions that the server should return. (You can imagine that the number of completions for a single letter could be very large.) The header_name is the name of the RFC2822 email header that the client wants a completion for, e.g. "To" or "Cc". This is included so that the mechanism could be extended to, for example, subject lines, newgroup names or other things. Finally, the pattern is the text that the user has entered so far.

The details of the search method that the server should employ are not specified. In effect, the server is in charge of which completions it should produce, not the client. The process is "automagic", like web searching, from the point of view of the user. In the case of Decimail Server, at present the text that the user has entered is matched case-insensitively at the start of the real name and the email address of the candidate addresses.

The response is sorted in the order in which it should be presented to the user. This may be most-likely-first, or lexicographical; again, this is the choice of the server. The format of the response is a list of space-separated quoted strings.

I think that this feature is a useful advance for Decimail. It's unfortunate that unlike every other feature this requires an extension that is not supported by other clients and servers. I do hope that other mail applications will pick up on this.