/usr/bin/imapd $HOME/Maildir
imapd is the Courier-IMAP server that provides IMAP access to Maildir mailboxes. Normally you don't have to worry about it, as imapd is automatically invoked after receiving a network connection, accompanied by the appropriate userid and password. A series of modules, starting with couriertcpd, followed by one or more authentication modules, followed by imaplogin take care of accepting the network connection, and authenticating the login.
When imapd is invoked in this fashion, it checks if the IMAP authentication request is accepted, and, if so, changes its current directory to the account's Maildir, and issues an OK response, telling the IMAP client that it's logged in.
if imapd may also be invoked from the shell prompt, in which case it issues a PREAUTH response, and changes the current directory to either its argument, or the contents of the MAILDIR environment variable, then attempts to talk IMAP on standard input and output.
imapd implements IMAP4REV1, as defined by RFC 2060.
AUTH* - imapd examines several environment variables whose names start with AUTH - these environment variables are set by imaplogin and authentication modules, and their absence tells imapd that it's being invoked from the command line.
MAILDIR - if defined, imapd changes its directory to the one specified by this environment variable. Otherwise imapd changes its directory to the one specified on the command line.
IMAP_USELOCKS - if this environment variables exists and is set to 1, imapd creates a lock file when scanning Maildirs for new messages. May be needed to support buggy IMAP clients that open multiple IMAP connections, and issue multiple commands in parallel.
IMAP_EMPTYTRASH - if it exists and is set to an integral number, it specifies a time interval in days. Messages in the Trash folder that are older than specified by this environment variable are automatically deleted.
`pwd`/. - current directory is assumed to be the main INBOX Maildir.
`pwd`/.folder - Maildir folders, each one containing their own tmp, new, cur, etc...