Here are a few items to note about aspNetIMAP to help you get more familiar with its functionality.

What is IMAP?

IMAP stands for Internet Message Access Protocol. It is used for downloading messages from the mail server, managing mailboxes (mail folders), and for retrieving parts of messages. IMAP is NOT to be confused with SMTP, which is used for sending email. IMAP is different from POP3, in that IMAP provides read and write access capabilities. Using IMAP not only messages can be downloaded, parts of messages can be downloaded. Message flags can also be updated, and mail can be written back to mail store. This is different than sending email, in that usually partial, or draft, messages are saved to the IMAP store.

The current version of IMAP is defined by RFC 3501. For an online reference, check out http://www.ietf.org/rfc/rfc3501.txt?number=3501 .

Structures found in aspNetIMAP

The following is a list of the major structures found in aspNetIMAP, along with a brief overview.

IMAP4

The IMAP4 object, can be thought of as the connection object to the IMAP server. It is used for authenticating to the IMAP server, along with setting IMAP wide settings.

MailFolder (referred to as MailBox in RFC 3501)

The MailFolder object is used for storing individual messages. Although the RFC calls it a mailbox, in aspNetIMAP it is referred to as a MailFolder. The MailFolder is similar to a folder found on your hard dive. With the MailFolder object, you can Open, Rename, Delete, Create, and Subscribe to folders.

MessageClient

The MessageClient object is used for retrieving and manipulating message properties.  Messages can be deleted, moved, copied, deleted, and checked for spam. Most of the message's properties deal with flags. For retrieving specific parts of the message, or the entire message, refer to the FetchClient.

Flags

Flags are a set of attributes that can applied to both MailFolders and messages. All system flags are prefaced with a "\". The following is list of the common flags applied to messages.

\answered
The \answered flag is set on a message by a client when it sends a reply. A client must explicitly set the flag. It is not set by the server, only stored and maintained.
 

\deleted
The \deleted flag is also set by the client. The client marks the message for deletion. Its not until Purge(), commonly known as Expunge, is called that the messages are physically removed from the server.


\draft
When composing a message, or replying to a message, you may want to suspend editing, or save for a later date. IMAP allows the client to store the message on the server with the \draft flag set. This allows the client to identify the message as a draft for later editing.

\flagged
A client can mark a message as "important", "flagged", or "marked" by setting the \flagged flag. Users can assign their own meaning to the flag, since unlike the other flags, \flagged has not special semantics.

\recent
\recent is a slightly more complicated flag than the others. When a new message arrives, the server sets the \recent flag, for the first client to see it. The \recent flag can be queried by clients to determine if there are any new messages on the server, since the last time messages were checked.

\seen
The last flag, is the \seen flag. It is also commonly referred to as the "read" flag, and is set when a message is read. Some methods allow you to read messages without setting the \seen flag. These methods can be found on the FetchClient, and and mark as message as read by setting the "markAsRead" parameter to true.

Envelope

The Envelope structure, closely matches the IMAP structure found in the RFCs. Envelope structures simplify querying IMAP servers for information about
specific messages. An envelope structure is a subset of the message header that provides a convenient subset of the message for folder summaries.
IMAP envelope fields are presented in the following format:
    Date
    Subject
    From
    Sender
    Reply-To
    To
    Cc
    Bcc
    In-Reply-To
    Message-Id
 

BodyStructure


The BodyStructure object is a class that describes the format of a mime message, on an IMAP server without actually having to download the entire message. The message is parsed on the server, and its hierarchy is sent back to the client. Because Mime messages are nested, a BodyStructure can also contain other BodyStructures. To find or inspect child BodyStructures, check out BodyStructure.Sections.

Although there are exceptions, each BodyStructure can be considered to map to a Mime message body part. For example, if a message contains a text/plain and a text/html part, there are actually three BodyStructures; the BodyStructure of the overall message, the BodyStructure of the text/plain part, and the BodyStructure of the text/html part.

Because the IMAP protocol is complicated, we found numerous parsing errors and exceptions when testing against various IMAP servers. Although we have tried to compensate for these problems, we are sure many more still exist. Because mail server companies focus on transporting mail, and not parsing it, we found their server side parsing implementations to be generally week. If you happen to find a bodystructure that does not "seem quite right", feel free to email us the IMAP log, for further inspection.
 

FastItem

The FastItem is a quick an efficient way of obtaining some basic information about a message. In a single IMAP command, all of the following information can be determined for a single message. It is the equivalent of querying the message for three different pieces of information, in a single command.
 

    Message Size -- The size of the message in bytes.

    InternalDate -- The internal date, as kept by the IMAP server. This may be different than the Date value found in the headers.

    Flags -- A collection of all the Flags associated with the message.