Network Working Group                                          C. Newman
Internet Draft: IMAP URL Scheme                                 Innosoft
Document: draft-newman-url-imap-00.txt                      October 1996


                            IMAP URL Scheme


Status of this memo

     This document is an Internet Draft.  Internet Drafts are working
     documents of the Internet Engineering Task Force (IETF), its Areas,
     and its Working Groups.  Note that other groups may also distribute
     working documents as Internet Drafts.

     Internet Drafts are draft documents valid for a maximum of six
     months.  Internet Drafts may be updated, replaced, or obsoleted by
     other documents at any time.  It is not appropriate to use Internet
     Drafts as reference material or to cite them other than as a
     ``working draft'' or ``work in progress``.

     To learn the current status of any Internet-Draft, please check the
     1id-abstracts.txt listing contained in the Internet-Drafts Shadow
     Directories on ds.internic.net, nic.nordu.net, ftp.isi.edu, or
     munnari.oz.au.

     A revised version of this draft document will be submitted to the
     RFC editor as a Proposed Standard for the Internet Community.
     Discussion and suggestions for improvement are requested.  This
     document will expire six months after publication.  Distribution of
     this draft is unlimited.



1. Introduction

     IMAP [IMAP4] is a rich protocol for accessing remote message
     stores.  It provides an ideal mechanism for accessing public
     mailing list archives as well as private and shared message stores.
     This document defines a URL scheme for referencing objects on an
     IMAP server.


2. IMAP scheme

     The IMAP URL scheme is used to designate mailboxes, messages,
     files, and search programs on Internet hosts accessible using the
     IMAP protocol.



Newman                                                          [Page 1]


Internet Draft              IMAP URL Scheme                 October 1996


     The IMAP URL follows the common Internet scheme syntax as defined
     in RFC 1738 [RFC1738].  If :<port> is omitted, the port defaults to
     143.

     An IMAP URL takes one of the following forms:

          imap://<login>/<list_mailbox>;type=<typecode>
          imap://<login>/<mailbox>/<uidvalidity>?<search-program>
          imap://<login>/<mailbox>/<uidvalidity>/<uid>/<section>

     The first form is used to refer to a list of mailboxes, the second
     form refers to a list of messages, and the final form refers to a
     specific message or message part.  The characters ";", "?", and "/"
     are reserved, and must be encoded if present in the <user>,
     <password>, <list_mailbox> or <mailbox>.


3. IMAP Name and Password

     A user name and password may be supplied.  They are used in the
     "LOGIN" command after making the connection to the IMAP server.  If
     no user name or password is supplied, the user name "anonymous" is
     used and the password is supplied as the Internet e-mail address of
     the end user accessing the resource.  If the URL supplies a user
     name but no password, the program interpreting the IMAP URL should
     request one from the user.


4. Lists of mailboxes

     An IMAP URL referring to a list of mailboxes has the following
     form:

          imap://<login>/<list_mailbox>;type=<typecode>

     The <typecode> may be either "LIST" or "LSUB", and is case
     insensitive.  The field ";type=<typecode>" may be omitted, in which
     case ";type=LIST" is assumed.

     The <list_mailbox> is any argument suitable for the list_mailbox
     field of the IMAP [IMAP4] LIST or LSUB commands.  The field
     "/<list_mailbox>" may be omitted, in which case the program
     interpreting the IMAP URL may use "*" or "%" as the <list_mailbox>.

     Note that if unsafe or reserved characters such as " ", "/", or "%"
     are present in <list_mailbox> they must be encoded as defined in
     RFC 1738 [RFC1738].




Newman                                                          [Page 2]


Internet Draft              IMAP URL Scheme                 October 1996


5. Lists of messages

     An IMAP URL referring to a list of messages has the following form:

          imap://<login>/<mailbox>/<uidvalidity>?<search-program>

     The <mailbox> field is used as the argument to the IMAP4 "SELECT"
     command.  Note that if unsafe or reserved characters such as " " or
     "/" are present in <mailbox> they must be encoded as defined in RFC
     1738 [RFC1738].

     The <uidvalidity> field is optional.  If it is present, it must be
     the argument to the IMAP4 UIDVALIDITY status response at the time
     the URL was created.  This MAY be used by the program interpreting
     the IMAP URL to determine if the URL is stale.

     The "?<search-program>" field is optional.  If it is not present, a
     list of all messages in the mailbox should be presented by the
     program interpreting the URL.  If it is present, it should be used
     as all the arguments following an IMAP4 SEARCH command.  Note that
     unsafe characters such as " " are likely to be present in the
     <search-program> and must be encoded as defined in RFC 1738
     [RFC1738].


6. A specific message or message part

     An IMAP URL referring to a specific message or message part has the
     following form:

          imap://<login>/<mailbox>/<uidvalidity>/<uid>/<section>

     The <mailbox> is as defined above.  The <uidvalidity> is mandatory
     for this format and is as defined above.  The <uidvalidity> SHOULD
     be used by the program interpreting the URL to determine if the URL
     is stale.

     The <uid> refers to an IMAP4 message UID, and should be used as the
     <set> argument to the IMAP4 "UID FETCH" command.

     The <section> field is optional.  If not present, the URL refers to
     the entire RFC 822 message as returned by the IMAP command "UID
     FETCH <uid> RFC822".  If present, the URL refers to the object
     returned by a "UID FETCH <uid> BODY[<section>]" command.  The type
     of the object may be determined by "UID FETCH <uid> BODYSTRUCTURE"
     and locating the appropriate part.  Note that unsafe characters in
     <section>, such as " " must be encoded as defined in RFC 1738
     [RFC1738].



Newman                                                          [Page 3]


Internet Draft              IMAP URL Scheme                 October 1996


7. ABNF for IMAP URL scheme

     This uses ABNF as used in the IMAP specification [IMAP4].
     Terminals from the BNF for URLs [RFC1738] are also used.

     imapurl          ::= "imap://" ilogin [ imailboxlist / isearch / ipath ]


     ilogin           ::= [ iuser [ ":" ipassword ] "@" ] hostport

     imailboxlist     ::= "/" list_mailbox [ ";type=" list_type ]
                             ;; unsafe characters in list_mailbox are
                             ;; encoded as in [RFC1738]

     ipassword        ::= *( uchar / "&" / "=" )

     ipath            ::= "/" mailbox "/" nz_number "/" number [ "/" section ]
                             ;; unsafe characters in mailbox and section are
                             ;; encoded as in [RFC1738]
                             ;; IMAP4 literals may not be used in mailbox

     isearch          ::= "/" mailbox "/" [nz_number] [ "?" search_program ]
                             ;; unsafe characters in mailbox and
                             ;; search_program, including SPACE and "/",
                             ;; are encoded as in [RFC1738]
                             ;; IMAP4 literals may not be used in mailbox
                             ;; or search_program

     iuser            ::= *( uchar / "&" / "=" )

     list_type        ::= "LIST" / "LSUB"
                             ;; case insensitive

     search_program   ::= ["CHARSET" SPACE astring SPACE] search_criteria
                             ;; IMAP4 literals may not be used



8. References

     [IMAP4] Crispin, M., "Internet Message Access Protocol - Version
     4", RFC 1730, University of Washington, December 1994.

             <URL:ftp://ds.internic.net/rfc/rfc1730.txt>

     [RFC1738] Berners-Lee, Masinter, McCahill, "Uniform Resource
     Locators (URL)", RFC 1738, CERN, Xerox Coproration, University of
     Minnesota, December 1994.



Newman                                                          [Page 4]


Internet Draft              IMAP URL Scheme                 October 1996


             <URL:ftp://ds.internic.net/rfc/rfc1738.txt>


9. Security Considerations

     IMAP URLs have the same security considerations as general Internet
     URLs [RFC1738].  Issues discussed in the IMAP specification [IMAP4]
     are also relevant.  No new security issues are introduced in this
     document.


10. Author's Address

     Chris Newman
     Innosoft
     1050 East Garvey Ave. South
     West Covina, CA 91790 USA

     Email: chris.newman@innosoft.com
































Newman                                                          [Page 5]