C# Class Crystalbyte.Equinox.Imap.ImapClient

Inheritance: Crystalbyte.Equinox.Security.SecureClient
显示文件 Open project: MichielDeMey/Kolibrie-Mail Class Usage Examples

Private Properties

Property Type Description
CheckForStatusUpdates void
FetchEntityBody string
FetchEntityText string
InvokeDownloadProgressChanged void
InvokeManualSaslAuthenticationRequired bool
InvokeStatusUpdateReceived void
InvokeStatusUpdateReceived void
ReceiveIdleStatusUpdates void
ReceiveSingleLine string
StoreInternal ImapResponseReader

Public Methods

Method Description
Append ( string mailboxName, Message message, MessageFlags flags = (MessageFlags)0x0000 ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse

The APPEND command appends the literal argument as a new message to the end of the specified destination mailbox. http://tools.ietf.org/html/rfc3501#section-6.3.11

Authenticate ( NetworkCredential credentials, SaslMechanics mechanic = (SaslMechanics)0x0000 ) : bool

Authenticates the client to the server using the best supported SASL mechanism.

Authenticate ( string username, string password, SaslMechanics mechanic = (SaslMechanics)0x0000 ) : bool

Authenticates the client to the server using the best supported SASL mechanism.

AuthenticateXOAuth ( string key ) : bool

Authenticates the client to the server using the XOAUTH mechanism.

Check ( ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse

The CHECK command requests a checkpoint of the currently selected mailbox. A checkpoint refers to any implementation-dependent housekeeping associated with the mailbox (e.g., resolving the server's in-memory state of the mailbox with the state on its disk) that is not normally executed as part of each command. A checkpoint MAY take a non-instantaneous amount of real time to complete. If a server implementation has no such housekeeping considerations, CHECK is equivalent to NOOP. http://tools.ietf.org/html/rfc2060#section-6.4.1

Close ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse

The CLOSE command permanently removes all messages that have the \Deleted flag set from the currently selected mailbox, and returns to the authenticated state from the selected state.

Copy ( Crystalbyte.Equinox.Imap.SequenceSet set, string destinationMailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse

The COPY command copies the specified message(s) to the end of the specified destination mailbox. http://tools.ietf.org/html/rfc3501#section-6.4.7

Create ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse

The CREATE command creates a mailbox with the given name. http://tools.ietf.org/html/rfc3501#section-6.3.3

Delete ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse

The DELETE command permanently removes the mailbox with the given name. http://tools.ietf.org/html/rfc3501#section-6.3.4

Dispose ( ) : void

Disposes of the client object. In addition calling this method will trigger an autoomated logout and disconnect from the server.

Examine ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.SelectExamineImapResponse

The EXAMINE command is identical to SELECT and returns the same output; however, the selected mailbox is identified as read-only. http://tools.ietf.org/html/rfc3501#section-6.3.2

Expunge ( ) : Crystalbyte.Equinox.Imap.Responses.ExpungeImapResponse

The EXPUNGE command permanently removes all messages that have the \Deleted flag set from the currently selected mailbox. Before returning an OK to the client, an untagged EXPUNGE response is sent for each message that is removed.

Fetch ( Crystalbyte.Equinox.Imap.SequenceSet set, string query ) : FetchImapResponse

The FETCH command retrieves data associated with a message in the mailbox. The data items to be fetched can be either a single atom or a parenthesized list. http://tools.ietf.org/html/rfc3501#section-6.4.5

FetchAttachment ( Crystalbyte.Equinox.Imap.AttachmentInfo info ) : Attachment

Fetches a single attachment from the requested message.

FetchMessageBySequenceNumber ( int sn ) : Message

Fetches a single message from the selected mailbox identified by its sequence number.

FetchMessageByUid ( int uid ) : Message

Fetches a single message from the selected mailbox identified by its unique identifier.

FetchNestedMessage ( Crystalbyte.Equinox.Imap.MessageInfo info ) : Message

Fetches a single nested message from the requested message.

FetchView ( Crystalbyte.Equinox.Imap.ViewInfo info ) : View

Fetches a single view from the requested message.

FetchView2 ( Crystalbyte.Equinox.Imap.ViewInfo info ) : View

Fetches a single view from the requested message.

ImapClient ( ) : System
LSub ( string referenceName, string wildcardedMailboxName ) : Crystalbyte.Equinox.Imap.Responses.ListImapResponse

The LSUB command returns a subset of names from the set of names that the user has declared as being "active" or "subscribed". http://tools.ietf.org/html/rfc3501#section-6.3.9

List ( string referenceName, string wildcardedMailboxName ) : ListImapResponse

The LIST command returns a subset of names from the complete set of all names available to the client. http://tools.ietf.org/html/rfc3501#section-6.3.8

Logout ( ) : ImapResponse

The LOGOUT command informs the server that the client is done with the connection. http://tools.ietf.org/html/rfc3501#section-6.1.3

Noop ( ) : ImapResponse

The NOOP command always succeeds. It does nothing. http://tools.ietf.org/html/rfc3501#section-6.1.2

Receive ( bool processStatusUpdatesAutomatically = true ) : ImapResponseReader

Receives a response from the server.

Rename ( string sourceName, string targetName ) : ImapResponse

The RENAME command changes the name of a mailbox. A tagged OK response is returned only if the mailbox has been renamed. It is an error to attempt to rename from a mailbox name that does not exist or to a mailbox name that already exists. Any error in renaming will return a tagged NO response.

Search ( string query, bool isUidSearch = false ) : SearchImapResponse

The SEARCH command searches the mailbox for messages that match the given searching criteria. Searching criteria consist of one or more search keys.

Select ( string mailboxName ) : SelectExamineImapResponse

The SELECT command selects a mailbox so that messages in the mailbox can be accessed. http://tools.ietf.org/html/rfc3501#section-6.3.1

Send ( ImapCommand command ) : void

Sends a command to the server.

SendAndReceive ( ImapCommand command, bool processStatusUpdatesAutomatically = true ) : ImapResponseReader

Sends a command to the server and returns a reader capable of receiving line by line.

SendAsync ( ImapCommand command ) : void

Sends a command to the server.

StartIdle ( ) : void

This method is blocking. The IDLE command may be used with any IMAP4 server implementation that returns "IDLE" as one of the supported capabilities to the CAPABILITY command. If the server does not advertise the IDLE capability, the client MUST NOT use the IDLE command and must poll for mailbox updates. http://tools.ietf.org/html/rfc2177

StopIdleAsync ( ) : void

Send the DONE command to the server on a seperate thread, which will release the IDLE lock.

Store ( SequenceSet set, MessageFlags flags, StoreProcedures procedure ) : StoreImapResponse

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6

Store ( SequenceSet set, string value, StoreProcedures procedure ) : StoreImapResponse

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6

StoreSilent ( SequenceSet set, MessageFlags flags, StoreProcedures procedure ) : ImapResponse

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6

StoreSilent ( SequenceSet set, string value, StoreProcedures procedure ) : ImapResponse

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6

Subscribe ( string mailboxName ) : ImapResponse

The SUBSCRIBE command adds the specified mailbox name to the server's set of "active" or "subscribed" mailboxes as returned by the LSUB command. http://tools.ietf.org/html/rfc3501#section-6.3.6

Unsubscribe ( string mailboxName ) : ImapResponse

The UNSUBSCRIBE command removes the specified mailbox name from the server's set of "active" or "subscribed" mailboxes as returned by the LSUB command. http://tools.ietf.org/html/rfc3501#section-6.3.7

Protected Methods

Method Description
FetchCapabilities ( ) : void
IsTlsSupported ( ) : bool
IssueStartTlsCommand ( string host ) : bool

Private Methods

Method Description
CheckForStatusUpdates ( Crystalbyte.Equinox.Imap.ImapResponseReader reader ) : void
FetchEntityBody ( IFetchable fetchable ) : string
FetchEntityText ( IFetchable fetchable ) : string
InvokeDownloadProgressChanged ( int received, int total ) : void
InvokeManualSaslAuthenticationRequired ( NetworkCredential credential, ImapClient client ) : bool

Attempt to notify the application that automatic sasl authentication is not possible. The ManualSaslAuthenticationRequired event will be thrown.

InvokeStatusUpdateReceived ( Crystalbyte.Equinox.Imap.StatusUpdateReceivedEventArgs e ) : void
InvokeStatusUpdateReceived ( string line ) : void
ReceiveIdleStatusUpdates ( ImapResponseReader reader ) : void
ReceiveSingleLine ( ) : string
StoreInternal ( SequenceSet set, string value, StoreProcedures procedure, string commandString ) : ImapResponseReader

Method Details

Append() public method

The APPEND command appends the literal argument as a new message to the end of the specified destination mailbox. http://tools.ietf.org/html/rfc3501#section-6.3.11
public Append ( string mailboxName, Message message, MessageFlags flags = (MessageFlags)0x0000 ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse
mailboxName string The name of the malbox to insert the message.
message Message The message to append.
flags MessageFlags Sets the flags of the message. This is optional.
return Crystalbyte.Equinox.Imap.Responses.ImapResponse

Authenticate() public method

Authenticates the client to the server using the best supported SASL mechanism.
public Authenticate ( NetworkCredential credentials, SaslMechanics mechanic = (SaslMechanics)0x0000 ) : bool
credentials System.Net.NetworkCredential The user credentials.
mechanic SaslMechanics The SASL mechanism to use. This param is optional and can be left blank (0x0000), if done so, the best fitting mechanism will be chosen automatically.
return bool

Authenticate() public method

Authenticates the client to the server using the best supported SASL mechanism.
public Authenticate ( string username, string password, SaslMechanics mechanic = (SaslMechanics)0x0000 ) : bool
username string The username, obviously.
password string The users password.
mechanic SaslMechanics The SASL mechanism to use. This param is optional and can be left blank (0x0000), if done so, the best fitting mechanism will be chosen automatically.
return bool

AuthenticateXOAuth() public method

Authenticates the client to the server using the XOAUTH mechanism.
public AuthenticateXOAuth ( string key ) : bool
key string The XOAUTH authetication key.
return bool

Check() public method

The CHECK command requests a checkpoint of the currently selected mailbox. A checkpoint refers to any implementation-dependent housekeeping associated with the mailbox (e.g., resolving the server's in-memory state of the mailbox with the state on its disk) that is not normally executed as part of each command. A checkpoint MAY take a non-instantaneous amount of real time to complete. If a server implementation has no such housekeeping considerations, CHECK is equivalent to NOOP. http://tools.ietf.org/html/rfc2060#section-6.4.1
public Check ( ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse
return Crystalbyte.Equinox.Imap.Responses.ImapResponse

Close() public method

The CLOSE command permanently removes all messages that have the \Deleted flag set from the currently selected mailbox, and returns to the authenticated state from the selected state.
public Close ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse
mailboxName string The targeted mailboxName.
return Crystalbyte.Equinox.Imap.Responses.ImapResponse

Copy() public method

The COPY command copies the specified message(s) to the end of the specified destination mailbox. http://tools.ietf.org/html/rfc3501#section-6.4.7
public Copy ( Crystalbyte.Equinox.Imap.SequenceSet set, string destinationMailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse
set Crystalbyte.Equinox.Imap.SequenceSet
destinationMailboxName string
return Crystalbyte.Equinox.Imap.Responses.ImapResponse

Create() public method

The CREATE command creates a mailbox with the given name. http://tools.ietf.org/html/rfc3501#section-6.3.3
public Create ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse
mailboxName string The name of the mailbox to create.
return Crystalbyte.Equinox.Imap.Responses.ImapResponse

Delete() public method

The DELETE command permanently removes the mailbox with the given name. http://tools.ietf.org/html/rfc3501#section-6.3.4
public Delete ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.ImapResponse
mailboxName string The name of the mailbox to delete.
return Crystalbyte.Equinox.Imap.Responses.ImapResponse

Dispose() public method

Disposes of the client object. In addition calling this method will trigger an autoomated logout and disconnect from the server.
public Dispose ( ) : void
return void

Examine() public method

The EXAMINE command is identical to SELECT and returns the same output; however, the selected mailbox is identified as read-only. http://tools.ietf.org/html/rfc3501#section-6.3.2
public Examine ( string mailboxName ) : Crystalbyte.Equinox.Imap.Responses.SelectExamineImapResponse
mailboxName string The name of the mailbox to select.
return Crystalbyte.Equinox.Imap.Responses.SelectExamineImapResponse

Expunge() public method

The EXPUNGE command permanently removes all messages that have the \Deleted flag set from the currently selected mailbox. Before returning an OK to the client, an untagged EXPUNGE response is sent for each message that is removed.
public Expunge ( ) : Crystalbyte.Equinox.Imap.Responses.ExpungeImapResponse
return Crystalbyte.Equinox.Imap.Responses.ExpungeImapResponse

Fetch() public method

The FETCH command retrieves data associated with a message in the mailbox. The data items to be fetched can be either a single atom or a parenthesized list. http://tools.ietf.org/html/rfc3501#section-6.4.5
public Fetch ( Crystalbyte.Equinox.Imap.SequenceSet set, string query ) : FetchImapResponse
set Crystalbyte.Equinox.Imap.SequenceSet The list of ids of the messages to fetch.
query string The query, consisting of message parts to fetch.
return FetchImapResponse

FetchAttachment() public method

Fetches a single attachment from the requested message.
public FetchAttachment ( Crystalbyte.Equinox.Imap.AttachmentInfo info ) : Attachment
info Crystalbyte.Equinox.Imap.AttachmentInfo The associated info object, this token can be obtained from the messages body structure.
return Attachment

FetchCapabilities() protected method

protected FetchCapabilities ( ) : void
return void

FetchMessageBySequenceNumber() public method

Fetches a single message from the selected mailbox identified by its sequence number.
public FetchMessageBySequenceNumber ( int sn ) : Message
sn int The sequence number of the requested message.
return Message

FetchMessageByUid() public method

Fetches a single message from the selected mailbox identified by its unique identifier.
public FetchMessageByUid ( int uid ) : Message
uid int The uid of the requested message.
return Message

FetchNestedMessage() public method

Fetches a single nested message from the requested message.
public FetchNestedMessage ( Crystalbyte.Equinox.Imap.MessageInfo info ) : Message
info Crystalbyte.Equinox.Imap.MessageInfo The associated info object, this token can be obtained from the messages body structure.
return Message

FetchView() public method

Fetches a single view from the requested message.
public FetchView ( Crystalbyte.Equinox.Imap.ViewInfo info ) : View
info Crystalbyte.Equinox.Imap.ViewInfo The associated info object, this token can be obtained from the messages body structure.
return View

FetchView2() public method

Fetches a single view from the requested message.
public FetchView2 ( Crystalbyte.Equinox.Imap.ViewInfo info ) : View
info Crystalbyte.Equinox.Imap.ViewInfo The associated info object, this token can be obtained from the messages body structure.
return View

ImapClient() public method

public ImapClient ( ) : System
return System

IsTlsSupported() protected method

protected IsTlsSupported ( ) : bool
return bool

IssueStartTlsCommand() protected method

protected IssueStartTlsCommand ( string host ) : bool
host string
return bool

LSub() public method

The LSUB command returns a subset of names from the set of names that the user has declared as being "active" or "subscribed". http://tools.ietf.org/html/rfc3501#section-6.3.9
public LSub ( string referenceName, string wildcardedMailboxName ) : Crystalbyte.Equinox.Imap.Responses.ListImapResponse
referenceName string The reference name.
wildcardedMailboxName string The mailbox name with possible wildcards.
return Crystalbyte.Equinox.Imap.Responses.ListImapResponse

List() public method

The LIST command returns a subset of names from the complete set of all names available to the client. http://tools.ietf.org/html/rfc3501#section-6.3.8
public List ( string referenceName, string wildcardedMailboxName ) : ListImapResponse
referenceName string The reference name.
wildcardedMailboxName string The mailbox name with possible wildcards.
return ListImapResponse

Logout() public method

The LOGOUT command informs the server that the client is done with the connection. http://tools.ietf.org/html/rfc3501#section-6.1.3
public Logout ( ) : ImapResponse
return ImapResponse

Noop() public method

The NOOP command always succeeds. It does nothing. http://tools.ietf.org/html/rfc3501#section-6.1.2
public Noop ( ) : ImapResponse
return ImapResponse

Receive() public method

Receives a response from the server.
public Receive ( bool processStatusUpdatesAutomatically = true ) : ImapResponseReader
processStatusUpdatesAutomatically bool
return ImapResponseReader

Rename() public method

The RENAME command changes the name of a mailbox. A tagged OK response is returned only if the mailbox has been renamed. It is an error to attempt to rename from a mailbox name that does not exist or to a mailbox name that already exists. Any error in renaming will return a tagged NO response.
public Rename ( string sourceName, string targetName ) : ImapResponse
sourceName string The fullname of the mailbox to rename.
targetName string The new name for the mailbox.
return ImapResponse

Search() public method

The SEARCH command searches the mailbox for messages that match the given searching criteria. Searching criteria consist of one or more search keys.
public Search ( string query, bool isUidSearch = false ) : SearchImapResponse
query string The query command that will be sent to the server.
isUidSearch bool Sets whether the search shall return uids instead of sequence numbers.
return SearchImapResponse

Select() public method

The SELECT command selects a mailbox so that messages in the mailbox can be accessed. http://tools.ietf.org/html/rfc3501#section-6.3.1
public Select ( string mailboxName ) : SelectExamineImapResponse
mailboxName string The name of the mailbox to select.
return SelectExamineImapResponse

Send() public method

Sends a command to the server.
public Send ( ImapCommand command ) : void
command ImapCommand The command to issue.
return void

SendAndReceive() public method

Sends a command to the server and returns a reader capable of receiving line by line.
public SendAndReceive ( ImapCommand command, bool processStatusUpdatesAutomatically = true ) : ImapResponseReader
command ImapCommand The command to issue.
processStatusUpdatesAutomatically bool This param defines whether received status updates will be processed automatically.
return ImapResponseReader

SendAsync() public method

Sends a command to the server.
public SendAsync ( ImapCommand command ) : void
command ImapCommand The command to issue.
return void

StartIdle() public method

This method is blocking. The IDLE command may be used with any IMAP4 server implementation that returns "IDLE" as one of the supported capabilities to the CAPABILITY command. If the server does not advertise the IDLE capability, the client MUST NOT use the IDLE command and must poll for mailbox updates. http://tools.ietf.org/html/rfc2177
public StartIdle ( ) : void
return void

StopIdleAsync() public method

Send the DONE command to the server on a seperate thread, which will release the IDLE lock.
public StopIdleAsync ( ) : void
return void

Store() public method

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6
public Store ( SequenceSet set, MessageFlags flags, StoreProcedures procedure ) : StoreImapResponse
set SequenceSet The sequence set representing the targeted messages, e.g. "1"; "1,2"; "2:4".
flags MessageFlags The flags to add or remove.
procedure StoreProcedures The procedure, whether to add or remove the flags.
return StoreImapResponse

Store() public method

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6
public Store ( SequenceSet set, string value, StoreProcedures procedure ) : StoreImapResponse
set SequenceSet The sequence set representing the targeted messages, e.g. "1"; "1,2"; "2:4".
value string The keyword to add or remove.
procedure StoreProcedures The procedure, whether to add or remove the flags.
return StoreImapResponse

StoreSilent() public method

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6
public StoreSilent ( SequenceSet set, MessageFlags flags, StoreProcedures procedure ) : ImapResponse
set SequenceSet The sequence set representing the targeted messages, e.g. "1"; "1,2"; "2:4".
flags MessageFlags The flags to add or remove.
procedure StoreProcedures The procedure, whether to add or remove the flags.
return ImapResponse

StoreSilent() public method

The STORE command alters data associated with a message in the mailbox. http://tools.ietf.org/html/rfc2060#section-6.4.6
public StoreSilent ( SequenceSet set, string value, StoreProcedures procedure ) : ImapResponse
set SequenceSet The sequence set representing the targeted messages, e.g. "1"; "1,2"; "2:4".
value string The keywords to add or remove.
procedure StoreProcedures The procedure, whether to add or remove the flags.
return ImapResponse

Subscribe() public method

The SUBSCRIBE command adds the specified mailbox name to the server's set of "active" or "subscribed" mailboxes as returned by the LSUB command. http://tools.ietf.org/html/rfc3501#section-6.3.6
public Subscribe ( string mailboxName ) : ImapResponse
mailboxName string The name of the mailbox to subscribe to.
return ImapResponse

Unsubscribe() public method

The UNSUBSCRIBE command removes the specified mailbox name from the server's set of "active" or "subscribed" mailboxes as returned by the LSUB command. http://tools.ietf.org/html/rfc3501#section-6.3.7
public Unsubscribe ( string mailboxName ) : ImapResponse
mailboxName string The name of the mailbox to subscribe to.
return ImapResponse