#### 3.4.1 IMAP URLs

The first kind of URL is an IMAP URL,3 which looks like this:

    imap://uname@hostname:port/mailbox

In this syntax, the parts ‘`uname@`’ and ‘`:port`’ are optional. Hostname is the internet host name or IP address of the IMAP server. Uname is the user name that identifies the account to be accessed on the server; this defaults to your user name. Port is the server’s IP port; this defaults to `143` and is normally not specified.

Mailbox specifies the IMAP mailbox (or folder, in IMAIL’s terminology) that is being referred to. Since most IMAP servers support hierarchical mailboxes, mailbox is a structured component indicating the location of the folder in the hierarchy, much like filenames or HTTP URLs. Here are some examples of IMAP URLs showing different mailbox paths:

    imap://localhost/inbox
    imap://localhost/inbox/sysadmin
    imap://localhost/inbox/sysadmin/equipment

Here you see several interesting properties of IMAP mailboxes. The first URL refers to the primary IMAP mailbox for this account, called the inbox. All IMAP servers must support this mailbox, which is always called ‘`inbox`’; the name is not case sensitive and may be typed in any combination of upper or lower case letters. However, case sensitivity for names other than ‘`inbox`’ is undefined by IMAP, so IMAIL treats all other names as if they were case sensitive.

The second and third URLs show how hierarchically-nested mailboxes are referred to: by writing the components of the path, separated by slashes. Note that IMAP does not require particular path-separator characters for hierarchical names, and in fact different IMAP servers use different separators. However, IMAIL always uses the forward-slash character as a separator, and translates to the server’s character as needed.4

Another thing to note about these examples is that IMAP, unlike most file systems, allows a folder to contain messages and to have subfolders. This includes the ‘`inbox`’ folder, as shown here. At least one server (Cyrus) puts all subfolders for a user account under ‘`inbox`’, but this is not required by IMAP and is not generally true.

#### Footnotes

### (3)

The syntax for IMAP URLs is defined by RFC 2192, except that IMAIL uses only a subset of the defined syntax.

### (4)

This is in opposition to RFC 2192, which specifies use of the server-specific separator. RFC 2396 and RFC 2718 provide compelling arguments against this design.