Imap Class |
Namespace: MailBee.ImapMail
The Imap type exposes the following members.
Name | Description | |
---|---|---|
Imap |
Creates an instance of Imap class.
| |
Imap(String) |
Creates and unlocks an instance of Imap class.
|
Name | Description | |
---|---|---|
Abort |
Forces MailBee to cancel all pending operations and close all opened connections
as soon as possible.
| |
BeginClose | Obsolete.
Begins an asynchronous request for closing (unselecting) the currently selected folder and optional removing of messages marked as deleted from this folder.
| |
BeginConnect | Obsolete.
Begins an asynchronous request for a connecting to an IMAP4 server.
| |
BeginCopyOrMoveMessages | Obsolete.
Begins an asynchronous request for copying or moving the specified messages from the currently selected folder to the specified folder.
| |
BeginDisconnect | Obsolete.
Begins an asynchronous request for a disconnection from the mail server.
| |
BeginDownloadEnvelopes | Obsolete.
Begins an asynchronous request for downloading the specified message elements
(envelopes, flags, body structures, entire messages or message headers, etc) from the currently selected folder.
| |
BeginDownloadEnvelopesEx | Obsolete.
Begins an asynchronous request for downloading the specified sets of message items (for each message, its own set of items can be requested) from the currently selected folder.
| |
BeginDownloadFolders | Obsolete.
Begins an asynchronous request for downloading IMAP folders matching the specified criteria.
| |
BeginExecuteCustomCommand | Obsolete.
Begins an asynchronous request for sending the specified user-defined command to the server and getting the response.
| |
BeginIdle | Obsolete.
Begins an asynchronous request for starting idling mode.
| |
BeginLogin | Obsolete.
Begins an asynchronous request for a logging in an account on an IMAP4 server.
| |
BeginSearch | Obsolete.
Begins an asynchronous request for searching the currently selected folder for messages meeting the specified criteria.
| |
BeginSelectFolder | Obsolete.
Begins an asynchronous request for selecting a folder in an account on an IMAP4 server.
| |
BeginSetMessageFlags | Obsolete.
Begins an asynchronous request to set or reset the specified message flags for the specified messages in the currently selected folder.
| |
BeginSortedSearch | Obsolete.
Begins an asynchronous request for searching the currently selected folder for messages meeting the specified criteria
and sorting them accordingly the specified sort condition.
| |
BeginStartTls | Obsolete.
Begins an asynchronous request to start TLS/SSL negotiation with the server.
| |
BeginUploadMessage | Obsolete.
Begins an asynchronous request for uploading the message into the specified folder on the server.
| |
Close |
Unselects the currently selected folder and removes all messages having \Deleted flag set from the folder.
| |
Close(Boolean) |
Unselects the currently selected folder and optionally removes all messages having \Deleted flag set from the folder.
| |
CloseAsync |
async/await version of Close.
| |
CloseAsync(Boolean) |
async/await version of Close(Boolean).
| |
Connect(String) |
Connects to an IMAP4 server on the standard IMAP4 port (143).
| |
Connect(String, Int32) |
Connects to an IMAP4 server.
| |
Connect(String, Int32, Socket, EndPoint) |
Connects to an IMAP4 server.
| |
ConnectAsync(String) |
async/await version of Connect(String).
| |
ConnectAsync(String, Int32) |
async/await version of Connect(String, Int32).
| |
ConnectAsync(String, Int32, Socket, EndPoint) |
async/await version of Connect(String, Int32, Socket, EndPoint).
| |
CopyMessages(String, Boolean, String) |
Copies the specified messages from the currently selected folder to the specified folder.
| |
CopyMessages(String, Boolean, String, UidPlusResult) |
Copies the specified messages from the currently selected folder to the specified folder,
and retrieves UIDs assigned to the copied messages in the destination folder.
| |
CopyMessagesAsync(String, Boolean, String) |
async/await version of CopyMessages(String, Boolean, String).
| |
CopyMessagesAsync(String, Boolean, String, UidPlusResult) |
async/await version of CopyMessages(String, Boolean, String, UidPlusResult).
| |
CreateFolder |
Creates a new folder (mailbox in IMAP4 terms) in the IMAP4 account.
| |
CreateFolderAsync |
async/await version of CreateFolder(String).
| |
DeleteFolder |
Deletes an existing folder (mailbox in IMAP4 terms) from the IMAP4 account.
| |
DeleteFolderAsync |
async/await version of DeleteFolder(String).
| |
DeleteMessages |
Marks the specified messages in the currently selected folder as deleted.
| |
DeleteMessagesAsync |
async/await version of DeleteMessages(String, Boolean).
| |
Disconnect |
Disconnects from the IMAP4 server and releases any used resources.
| |
DisconnectAsync |
async/await version of Disconnect.
| |
Dispose |
Closes all opened network connections (if any) and releases any used system resources.
| |
Dispose(Boolean) |
When overridden in a derived class, must release unmanaged and optionally managed
resources used by the component.
| |
DownloadEntireMessage |
Completely downloads the specified message from the server.
| |
DownloadEntireMessageAsync |
async/await version of DownloadEntireMessage(Int64, Boolean).
| |
DownloadEntireMessages |
Completely downloads the specified messages from the server.
| |
DownloadEntireMessagesAsync |
async/await version of DownloadEntireMessages(String, Boolean).
| |
DownloadEnvelopes(String, Boolean) |
Fetches message envelopes from the server.
| |
DownloadEnvelopes(String, Boolean, EnvelopeParts, Int32) |
Fetches message envelopes, bodies, headers, flags, attributes, and other message-related information from the server.
| |
DownloadEnvelopes(String, Boolean, EnvelopeParts, Int32, String, String) |
Fetches message envelopes, bodies, headers, flags, attributes, and other message-related information from the server.
| |
DownloadEnvelopesAsync(String, Boolean) |
async/await version of DownloadEnvelopes(String, Boolean).
| |
DownloadEnvelopesAsync(String, Boolean, EnvelopeParts, Int32) |
async/await version of DownloadEnvelopes(String, Boolean, EnvelopeParts, Int32).
| |
DownloadEnvelopesAsync(String, Boolean, EnvelopeParts, Int32, String, String) |
async/await version of DownloadEnvelopes(String, Boolean, EnvelopeParts, Int32, String, String).
| |
DownloadEnvelopesEx |
Fetches message envelopes, bodies, headers, flags, attributes, etc from the server allowing you to request different items
for every message in the list.
| |
DownloadEnvelopesExAsync |
async/await version of DownloadEnvelopesEx(Int64, Boolean, EnvelopeParts, Int32, String, String).
| |
DownloadFolders |
Downloads the list of all IMAP folders of the mail account.
| |
DownloadFolders(Boolean) |
Downloads the list of IMAP folders of the mail account.
| |
DownloadFolders(Boolean, String, String) |
Downloads the list of IMAP folders matching the specified criteria.
| |
DownloadFoldersAsync |
async/await version of DownloadFolders.
| |
DownloadFoldersAsync(Boolean) |
async/await version of DownloadFolders(Boolean).
| |
DownloadFoldersAsync(Boolean, String, String) |
async/await version of DownloadFolders(Boolean, String, String).
| |
DownloadMessageHeaders |
Downloads the header of each message in the specified set from the server.
| |
DownloadMessageHeadersAsync |
async/await version of DownloadMessageHeaders(String, Boolean).
| |
EndClose |
Ends the pending asynchronous close folder request.
| |
EndConnect |
Ends the pending asynchronous connection request.
| |
EndCopyOrMoveMessages |
Ends a pending asynchronous request for copying or moving messages.
| |
EndDisconnect |
Ends a pending asynchronous disconnection request.
| |
EndDownloadEnvelopes |
Ends the pending asynchronous download envelopes request.
| |
EndDownloadEnvelopesEx |
Ends the pending asynchronous request of pipelined downloading envelopes.
| |
EndDownloadFolders |
Ends the pending asynchronous download folders request.
| |
EndExecuteCustomCommand |
Ends the pending asynchronous request for sending user-defined command to the server.
| |
EndIdle |
Ends the pending asynchronous request for idling termination.
| |
EndLogin |
Ends the pending asynchronous login request.
| |
EndSearch |
Ends the pending asynchronous search request.
| |
EndSelectFolder |
Ends the pending asynchronous select folder request.
| |
EndSetMessageFlags |
Ends a pending asynchronous setting message flags request.
| |
EndSortedSearch |
Ends the pending asynchronous sorted search request.
| |
EndStartTls |
Ends a pending asynchronous TLS/SSL negotiation request.
| |
EndUploadMessage |
Ends the pending asynchronous upload message request.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
ExamineFolder |
Selects the specified folder (mailbox in IMAP4 terms) for read-only access.
| |
ExamineFolderAsync |
async/await version of ExamineFolder(String).
| |
ExecuteCustomCommand |
Sends user-defined command to the server and receives the server response to this command.
| |
ExecuteCustomCommandAsync |
async/await version of ExecuteCustomCommand(String, String).
| |
Expunge |
Permanently removes all the messages marked as deleted from the currently selected folder.
| |
Expunge(String, Boolean) |
Permanently removes the messages marked as deleted from the currently selected folder.
| |
ExpungeAsync |
async/await version of Expunge.
| |
ExpungeAsync(String, Boolean) |
async/await version of Expunge(String, Boolean).
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetAccountQuota |
Gets the quota (resource usage limit) of the entire mail account on the server.
| |
GetAccountQuotaAsync |
async/await version of GetAccountQuota.
| |
GetErrorDescription |
Returns a textual description of the last occurred error.
| |
GetExtension |
Returns the name of the specified IMAP4 capability if it's supported by the mail server.
| |
GetExtensions |
Returns a reference to the key-value list of the mail server capabilities.
| |
GetFolderQuota |
Gets the quota (resource usage limit) of the specified folder.
| |
GetFolderQuotaAsync |
async/await version of GetFolderQuota(String).
| |
GetFolderSize |
Downloads the size of each message in the currently selected folder and returns the total size
occupied by all messages in this folder.
| |
GetFolderSizeAsync |
async/await version of GetFolderSize.
| |
GetFolderStatus |
Gets the status of the specified folder without selecting it.
| |
GetFolderStatusAsync |
async/await version of GetFolderStatus(String).
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetNamespaces |
Downloads the list of IMAP4 namespaces available for the currently logged mail user.
| |
GetNamespacesAsync |
async/await version of GetNamespaces.
| |
GetServerResponse |
Returns the last response from the server.
| |
GetServerResponses |
Returns the specified individual responses from the last group of responses received from the server.
| |
GetSocket |
Returns the underlying Socket MailBee uses for the
current network connection.
| |
GetSocketError |
Returns a Win32 error code of the last socket-related error.
| |
GetSpecialFolder |
Gets a reference to the special folder of the specified kind.
| |
GetStream |
Returns the underlying Stream MailBee uses for the
current network connection.
| |
GetSupportedAuthMethods |
Returns a set of flags indicating which authentication methods are supported by the server.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Idle |
Attempts to start idling mode which makes the client wait for any notifications
from the server regarding the currently selected folder.
| |
IdleAsync |
async/await version of Idle.
| |
Login(String, String) |
Logs in a mail account on the IMAP4 server.
| |
Login(String, String, AuthenticationMethods) |
Logs in a mail account on the IMAP4 server.
| |
Login(String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) |
Logs in a mail account on the IMAP4 server.
| |
Login(String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) |
Logs in a mail account on the IMAP4 server.
| |
LoginAsync(String, String) |
async/await version of Login(String, String).
| |
LoginAsync(String, String, AuthenticationMethods) |
async/await version of Login(String, String, AuthenticationMethods).
| |
LoginAsync(String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) |
async/await version of Login(String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod).
| |
LoginAsync(String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) |
async/await version of Login(String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod).
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
MoveMessages(String, Boolean, String) |
Moves the specified messages from the currently selected folder to the specified folder.
| |
MoveMessages(String, Boolean, String, UidPlusResult) |
Moves the specified messages from the currently selected folder to the specified folder,
and retrieves UIDs assigned to the moved messages in the destination folder.
| |
MoveMessagesAsync(String, Boolean, String) |
async/await version of MoveMessages(String, Boolean, String).
| |
MoveMessagesAsync(String, Boolean, String, UidPlusResult) |
async/await version of MoveMessages(String, Boolean, String, UidPlusResult).
| |
Noop |
Sends a NOOP command to the mail server.
| |
NoopAsync |
async/await version of Noop.
| |
OnConnected |
Used by MailBee to raise Connected event.
| |
OnDataReceived |
Used by MailBee to raise DataReceived event.
| |
OnDataSent |
Used by MailBee to raise DataSent event.
| |
OnDisconnected |
Used by MailBee to raise Disconnected event.
| |
OnEnvelopeDataChunkReceived |
Used by MailBee to raise EnvelopeDataChunkReceived event.
| |
OnEnvelopeDownloaded |
Used by MailBee to raise EnvelopeDownloaded event.
| |
OnErrorOccurred |
Used by MailBee to raise ErrorOccurred event.
| |
OnHostResolved |
Used by MailBee to raise HostResolved event.
| |
OnIdling |
Used by MailBee to raise Idling event.
| |
OnLoggedIn |
Used by MailBee to raise LoggedIn event.
| |
OnLogNewEntry |
Used by MailBee to raise LogNewEntry event.
| |
OnLowLevelDataReceived |
Used by MailBee to raise LowLevelDataReceived event.
| |
OnLowLevelDataSent |
Used by MailBee to raise LowLevelDataSent event.
| |
OnMessageStatus |
Used by MailBee to raise MessageStatus event.
| |
OnServerStatus |
Used by MailBee to raise ServerStatus event.
| |
OnSocketConnected |
Used by MailBee to raise SocketConnected event.
| |
OnSocketCreating |
Used by MailBee to raise SocketCreating event.
| |
OnTlsStarted |
Used by MailBee to raise TlsStarted event.
| |
QuickDownloadMessage(String, String, String, String, Int32) |
Completely downloads the specified message from the specified folder on the server,
in a single line of code.
| |
QuickDownloadMessage(String, String, String, String, Int32, Int32) |
Downloads the specified message (entire message or message header only) from the specified folder on the server,
in a single line of code.
| |
QuickDownloadMessages(String, String, String, String) |
Completely downloads all the messages in the specified folder on the server,
in a single line of code.
| |
QuickDownloadMessages(String, String, String, String, Int32) |
Downloads all the messages (entire messages or message headers only) in the specified folder on the server,
in a single line of code.
| |
RenameFolder |
Renames an existing folder (mailbox in IMAP4 terms) of the IMAP4 account.
| |
RenameFolderAsync |
async/await version of RenameFolder(String, String).
| |
ResetState |
Resets the internal state of the component.
| |
Search |
Returns the collection of UIDs of all messages in the currently selected folder.
| |
Search(Boolean, String, String) |
Searches the currently selected folder for messages that meet the specified criteria.
| |
SearchAsync |
async/await version of Search.
| |
SearchAsync(Boolean, String, String) |
async/await version of Search(Boolean, String, String).
| |
SelectFolder |
Selects the specified folder (mailbox in IMAP4 terms) for read-write access.
| |
SelectFolderAsync |
async/await version of SelectFolder(String).
| |
SetMessageFlags(String, Boolean, SystemMessageFlags, MessageFlagAction) |
Sets or resets the specified flags for the specified messages in the currently selected folder.
| |
SetMessageFlags(String, Boolean, String, MessageFlagAction, Boolean) |
Sets or resets the specified flags for the specified messages in the currently selected folder.
| |
SetMessageFlagsAsync(String, Boolean, SystemMessageFlags, MessageFlagAction) |
async/await version of SetMessageFlags(String, Boolean, SystemMessageFlags, MessageFlagAction).
| |
SetMessageFlagsAsync(String, Boolean, String, MessageFlagAction, Boolean) |
async/await version of SetMessageFlags(String, Boolean, String, MessageFlagAction, Boolean).
| |
SortedSearch |
Searches the currently selected folder for messages that meet the specified criteria and returns them as a
collection sorted by the specified condition.
| |
SortedSearchAsync |
async/await version of SortedSearch(Boolean, String, String, String).
| |
StartTls |
Requests the mail server to start TLS/SSL negotiation and protect the existing connection with a security layer.
| |
StartTlsAsync |
async/await version of StartTls.
| |
StopIdle |
Notifies MailBee to terminate idling when appropriate.
| |
SubscribeFolder |
Subscribes to the specified folder (mailbox in IMAP4 terms) of the IMAP4 account.
| |
SubscribeFolderAsync |
async/await version of SubscribeFolder(String).
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UnsubscribeFolder |
Unsubscribes the previously subscribed folder (mailbox in IMAP4 terms) of the IMAP4 account.
| |
UnsubscribeFolderAsync |
async/await version of UnsubscribeFolder(String).
| |
UploadMessage(MailMessage, String) |
Uploads a mail message to the specified folder.
| |
UploadMessage(MailMessage, String, SystemMessageFlags) |
Uploads a mail message to the specified folder and assigns the specified flags to this message.
| |
UploadMessage(MailMessage, String, String, DateTime) |
Uploads a mail message to the specified folder and assigns the specified date and flags to this message.
| |
UploadMessage(MailMessage, String, String, String) |
Uploads a mail message to the specified folder and assigns the specified date and flags to this message.
| |
UploadMessage(MailMessage, String, String, String, Boolean, UidPlusResult) |
Uploads a mail message to the specified folder, assigns the specified date and flags to this message,
and retrieves UID assigned to the uploaded message by the server.
| |
UploadMessageAsync(MailMessage, String) |
async/await version of UploadMessage(MailMessage, String).
| |
UploadMessageAsync(MailMessage, String, SystemMessageFlags) |
async/await version of UploadMessage(MailMessage, String, SystemMessageFlags).
| |
UploadMessageAsync(MailMessage, String, String, DateTime) |
async/await version of UploadMessage(MailMessage, String, String, DateTime).
| |
UploadMessageAsync(MailMessage, String, String, String) |
async/await version of UploadMessage(MailMessage, String, String, String).
| |
UploadMessageAsync(MailMessage, String, String, String, Boolean, UidPlusResult) |
async/await version of UploadMessage(MailMessage, String, String, String, Boolean, UidPlusResult).
| |
Wait | Obsolete.
Waits until the currently running (if any) asynchronous method is finished.
| |
Wait(Int32) | Obsolete.
Waits the completion of the currently running (if any) asynchronous method
for the specified amount of time.
|
Name | Description | |
---|---|---|
AllMessages |
Specifies the message set (sequence) which includes all messages in the folder.
|
Name | Description | |
---|---|---|
EnableLastDownloaded |
Gets or sets whether MailBee should save currently downloaded envelopes in LastDownloadedEnvelopes property.
| |
Flags |
Gets the flags that are applicable for the currently selected folder.
| |
IsAborted |
Indicates whether Abort method has been called for the component.
| |
IsBusy |
Indicates whether the component is performing a lengthy operation.
| |
IsConnected |
Indicates whether the component is connected to the server.
| |
IsFolderSelected |
Indicates if a folder is currently selected in the mail account.
| |
IsIdle |
Gets if the component is in IDLE state.
| |
IsLoggedIn |
Indicates whether the component has already successfully authenticated on the server
and logged in the user account.
| |
IsSslConnection |
Indicates whether the current connection (if any) is secured with TLS/SSL layer.
| |
LastDownloadedEnvelopes |
Gets the collection of the envelopes downloaded to the current moment.
| |
LastResult |
Gets a numeric code of the last error.
| |
LicenseKey | Obsolete.
Assigns the license key.
| |
Log |
Gets the object used for logging MailBee activities into a file or memory buffer.
| |
MessageCount |
Gets the number of messages in the currently selected folder.
| |
PermanentFlags |
Gets the flags the client can change permanently.
| |
Proxy |
Provides access to the settings which allow MailBee to connect to a mail server via a proxy server.
| |
RaiseEvents |
Gets or sets whether the component will raise any events.
| |
RaiseEventsViaMessageLoop |
Gets or sets whether the events will be raised on the message loop of the application
or not.
| |
RecentCount |
Gets the number of recent messages in the currently selected folder.
| |
RequestEncoding |
Gets or sets the encoding used to convert a string into a bytes stream
which is then sent to the mail server.
| |
ResponseEncoding |
Gets or sets the encoding used to convert a byte data received from the mail server into a string.
| |
SetSeenForEntireMessages |
Specifies if MailBee should also set SEEN flag when downloading entire messages.
| |
Site |
Gets or sets the object to be used as a site for the component.
| |
SslCertificates |
Provides access to the client and server SSL certificate settings.
| |
SslMode |
Gets or sets how the component should establish TLS/SSL connection with the mail server.
| |
SslProtocol |
Gets or sets the security protocol to be used for performing TLS/SSL negotiation and data encryption.
| |
SynchronizingObject |
Gets or sets the object used to marshal the calls of the event handlers.
| |
ThrowExceptions |
Gets or sets whether the component will throw exceptions on errors.
| |
Timeout |
Gets or sets the amount of time (in milliseconds) the component will wait for a response from the server.
| |
TrialDaysLeft |
Gets the number of days left to the date of the trial license key expiration.
| |
UidNext |
Gets the UID to be assigned to the next message in the currently selected folder.
| |
UidValidity |
Gets the UIDVALIDITY value of the currently selected folder.
| |
Unseen |
Gets the ordinal message number of the first message which does not have "\Seen" flag set.
| |
UseXList |
Gets or sets whether to use XLIST extension which allows the application to detect special folders like
Sent, Drafts, Trash.
| |
Utf7EncodeFolderNames |
Gets or sets whether MailBee should automatically encode folder names with UTF-7 Modified encoding.
| |
Version |
Gets the version of the MailBee assembly.
|
Name | Description | |
---|---|---|
Connected |
Occurs when the connection with the server is successfully established.
| |
DataReceived |
Occurs when data is received from the IMAP4 server.
| |
DataSent |
Occurs when data is sent to the IMAP4 server.
| |
Disconnected |
Occurs when the connection with the server gets closed.
| |
Disposed |
Occurs after the component was disposed.
| |
EnvelopeDataChunkReceived |
Occurs on progress of downloading FETCH responses (containing message source data, envelopes, and other message-related information) from the server.
| |
EnvelopeDownloaded |
Occurs when a FETCH response is received from the IMAP4 server and the method which receives
mail messages or envelopes (such as DownloadEnvelopes(String, Boolean, EnvelopeParts, Int32, String, String)) is in progress.
| |
ErrorOccurred |
Occurs when the MailBeeException is thrown.
| |
HostResolved |
Occurs when the IMAP4 server name is successfully resolved into IP address(es).
| |
Idling |
Ticks every 10 milliseconds while in idle state.
| |
LoggedIn |
Occurs when the component successfully authenticates the user on the server and logs
in the user account.
| |
LogNewEntry | ||
LowLevelDataReceived |
Occurs when data is received from the connected socket.
| |
LowLevelDataSent |
Occurs when data is sent to the connected socket.
| |
MessageStatus |
Occurs when the IMAP4 server informs the client of any changes to mail messages in the currently selected folder.
| |
ServerStatus |
Occurs when the IMAP4 server reports mailbox or server status information to the client.
| |
SocketConnected |
Occurs when the IMAP4 server accepts the connection attempt and opens the transmission
channel between the remote host (IMAP4 server) and the client (MailBee).
| |
SocketCreating |
Occurs when MailBee needs a new socket object for establishing a connection with the IMAP4 server.
| |
TlsStarted |
Occurs when the connection with the server becomes secure.
|
using System; using MailBee; using MailBee.ImapMail; class Sample { static void Main(string[] args) { Imap imp = new Imap(); // Connect to the server, login and select inbox. imp.Connect("mail.somecompany.com"); imp.Login("jdoe@somecompany.com", "secret"); imp.SelectFolder("INBOX"); string range; // Does the inbox contain at least 10 mails? if (imp.MessageCount >= 10) { // We'll get last 10 mails. range = (imp.MessageCount - 9).ToString() + ":" + "*"; } else { // We'll get all mails. range = Imap.AllMessages; } // Get envelopes for the specified messages. EnvelopeCollection envelopes = imp.DownloadEnvelopes(range, false); // Make newer messages be displayed first. envelopes.Reverse(); foreach (Envelope env in envelopes) { Console.WriteLine("Message #" + env.MessageNumber); Console.WriteLine("From: " + env.From.ToString()); Console.WriteLine("To: " + env.To.ToString()); Console.WriteLine("Subject: " + env.Subject); Console.WriteLine(); } // Disconnect from the server. imp.Disconnect(); } }