View on GitHub

MailKit

MailKit: A cross-platform .NET mail-client library optimized for mobile.

Download this project as a .zip file Download this project as a tar.gz file

Pop3Client Class

A POP3 client that can be used to retrieve messages from a server.

Syntax

public class Pop3Client : MailKit.MailSpool

Remarks

The MailKit.Net.Pop3.Pop3Client class supports both the "pop3" and "pop3s" protocols. The "pop3" protocol makes a clear-text connection to the POP3 server and does not use SSL or TLS unless the POP3 server supports the STLS extension (as defined by rfc2595). The "pop3s" protocol, however, connects to the POP3 server using an SSL-wrapped connection.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Members

See Also: Inherited members from MailKit.MailSpool.

Public Constructors

Initializes a new instance of the MailKit.Net.Pop3.Pop3Client class.
Initializes a new instance of the MailKit.Net.Pop3.Pop3Client class.

Public Properties

[read-only]
override
AuthenticationMechanisms HashSet<string> . Gets the authentication mechanisms supported by the POP3 server.
[read-only]
abstract
AuthenticationMechanisms HashSet<string> . Gets the authentication mechanisms supported by the mail server. (Inherited from MailKit.MailService.)
Capabilities Pop3Capabilities . Gets the capabilities supported by the POP3 server.
ClientCertificates System.Security.Cryptography.X509Certificates.X509CertificateCollection . Gets or sets the client SSL certificates. (Inherited from MailKit.MailService.)
[read-only]
ExpirePolicy int . Gets the expiration policy.
[read-only]
Implementation string . Gets the implementation details of the server.
[read-only]
override
IsConnected bool . Gets whether or not the client is currently connected to an POP3 server.
[read-only]
abstract
IsConnected bool . Gets whether or not the client is currently connected to an mail server. (Inherited from MailKit.MailService.)
[read-only]
LoginDelay int . Gets the minimum delay, in milliseconds, between logins.
[read-only]
override
SupportsUids bool . Gets whether or not the MailKit.Net.Pop3.Pop3Client supports referencing messages by UIDs.
[read-only]
abstract
SupportsUids bool . Get whether or not the service supports referencing messages by UIDs. (Inherited from MailKit.MailSpool.)
[read-only]
override
SyncRoot object . Gets the lock object used by the default Async methods.
[read-only]
abstract
SyncRoot object . Gets an object that can be used to synchronize access to the folder. (Inherited from MailKit.MailService.)
override
Timeout int . Gets or sets the timeout for network streaming operations, in milliseconds.
abstract
Timeout int . Gets or sets the timeout for network streaming operations, in milliseconds. (Inherited from MailKit.MailService.)

Protected Properties

[read-only]
override
Protocol string . Gets the protocol supported by the message service.
[read-only]
abstract
Protocol string . Gets the protocol supported by the message service. (Inherited from MailKit.MailService.)

Public Methods

override
Authenticate (System.Net.ICredentials, System.Threading.CancellationToken)
Authenticates using the supplied credentials.
abstract
Authenticate (System.Net.ICredentials, System.Threading.CancellationToken)
Authenticates using the supplied credentials. (Inherited from MailKit.MailService.)
Authenticate (string, string, System.Threading.CancellationToken)
Authenticates using the specified user name and password. (Inherited from MailKit.MailService.)
AuthenticateAsync (System.Net.ICredentials, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously authenticates using the supplied credentials. (Inherited from MailKit.MailService.)
AuthenticateAsync (string, string, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously authenticates using the specified user name and password. (Inherited from MailKit.MailService.)
override
Connect (Uri, System.Threading.CancellationToken)
Establishes a connection to the specified POP3 server.
abstract
Connect (Uri, System.Threading.CancellationToken)
Establishes a connection to the specified mail server. (Inherited from MailKit.MailService.)
Connect (string, int, bool, System.Threading.CancellationToken)
Establishes a connection to the specified mail server. (Inherited from MailKit.MailService.)
ConnectAsync (Uri, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously establishes a connection to the specified mail server. (Inherited from MailKit.MailService.)
ConnectAsync (string, int, bool, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously establishes a connection to the specified mail server. (Inherited from MailKit.MailService.)
override
DeleteAllMessages (System.Threading.CancellationToken)
Mark all messages for deletion.
abstract
DeleteAllMessages (System.Threading.CancellationToken)
Mark all messages for deletion. (Inherited from MailKit.MailSpool.)
DeleteAllMessagesAsync (System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously mark all messages for deletion. (Inherited from MailKit.MailSpool.)
override
DeleteMessage (int, System.Threading.CancellationToken)
Mark the specified message for deletion.
abstract
DeleteMessage (int, System.Threading.CancellationToken)
Mark the specified message for deletion. (Inherited from MailKit.MailSpool.)
override
DeleteMessage (string, System.Threading.CancellationToken)
Mark the specified message for deletion.
abstract
DeleteMessage (string, System.Threading.CancellationToken)
Mark the specified message for deletion. (Inherited from MailKit.MailSpool.)
DeleteMessageAsync (int, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously mark the specified message for deletion. (Inherited from MailKit.MailSpool.)
DeleteMessageAsync (string, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously mark the specified message for deletion. (Inherited from MailKit.MailSpool.)
override
DeleteMessages (IList<int>, System.Threading.CancellationToken)
Mark the specified messages for deletion.
abstract
DeleteMessages (IList<int>, System.Threading.CancellationToken)
Mark the specified messages for deletion. (Inherited from MailKit.MailSpool.)
override
DeleteMessages (IList<string>, System.Threading.CancellationToken)
Mark the specified messages for deletion.
abstract
DeleteMessages (IList<string>, System.Threading.CancellationToken)
Mark the specified messages for deletion. (Inherited from MailKit.MailSpool.)
override
DeleteMessages (int, int, System.Threading.CancellationToken)
Mark the specified range of messages for deletion.
abstract
DeleteMessages (int, int, System.Threading.CancellationToken)
Mark the specified range of messages for deletion. (Inherited from MailKit.MailSpool.)
DeleteMessagesAsync (IList<int>, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously mark the specified messages for deletion. (Inherited from MailKit.MailSpool.)
DeleteMessagesAsync (IList<string>, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously mark the specified messages for deletion. (Inherited from MailKit.MailSpool.)
DeleteMessagesAsync (int, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously mark the specified range of messages for deletion. (Inherited from MailKit.MailSpool.)
override
Disconnect (bool, System.Threading.CancellationToken)
Disconnect the service.
abstract
Disconnect (bool, System.Threading.CancellationToken)
Disconnects the service. (Inherited from MailKit.MailService.)
DisconnectAsync (bool, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously disconnects the service. (Inherited from MailKit.MailService.)
Dispose ()
Releases all resource used by the MailKit.MailService object. (Inherited from MailKit.MailService.)
EnableUTF8 (System.Threading.CancellationToken)
Enable UTF8 mode.
EnableUTF8Async (System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously enable UTF8 mode.
Finalize ()
Releases unmanaged resources and performs other cleanup operations before the MailKit.MailService is reclaimed by garbage collection. (Inherited from MailKit.MailService.)
override
GetEnumerator () : IEnumerator<MimeKit.MimeMessage>
Gets an enumerator for the messages in the folder.
abstract
GetEnumerator () : IEnumerator<MimeKit.MimeMessage>
Gets an enumerator for the messages in the folder. (Inherited from MailKit.MailSpool.)
GetLanguages (System.Threading.CancellationToken) : IList<Pop3Language>
Get the list of languages supported by the POP3 server.
GetLanguagesAsync (System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<Pop3Language>>
Asynchronously get the list of languages supported by the POP3 server.
override
GetMessage (int, System.Threading.CancellationToken) : MimeKit.MimeMessage
Get the message at the specified index.
abstract
GetMessage (int, System.Threading.CancellationToken) : MimeKit.MimeMessage
Get the message at the specified index. (Inherited from MailKit.MailSpool.)
override
GetMessage (string, System.Threading.CancellationToken) : MimeKit.MimeMessage
Get the message with the specified UID.
abstract
GetMessage (string, System.Threading.CancellationToken) : MimeKit.MimeMessage
Get the message with the specified UID. (Inherited from MailKit.MailSpool.)
GetMessageAsync (int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<MimeKit.MimeMessage>
Asynchronously get the message at the specified index. (Inherited from MailKit.MailSpool.)
GetMessageAsync (string, System.Threading.CancellationToken) : System.Threading.Tasks.Task<MimeKit.MimeMessage>
Asynchronously get the message with the specified UID. (Inherited from MailKit.MailSpool.)
override
GetMessageCount (System.Threading.CancellationToken) : int
Get the number of messages available in the message spool.
abstract
GetMessageCount (System.Threading.CancellationToken) : int
Get the number of messages available in the message spool. (Inherited from MailKit.MailSpool.)
GetMessageCountAsync (System.Threading.CancellationToken) : System.Threading.Tasks.Task<int>
Asynchronously get the number of messages available in the message spool. (Inherited from MailKit.MailSpool.)
override
GetMessageHeaders (IList<int>, System.Threading.CancellationToken) : IList<MimeKit.HeaderList>
Get the headers for the specified messages.
abstract
GetMessageHeaders (IList<int>, System.Threading.CancellationToken) : IList<MimeKit.HeaderList>
Get the headers for the specified messages. (Inherited from MailKit.MailSpool.)
override
GetMessageHeaders (IList<string>, System.Threading.CancellationToken) : IList<MimeKit.HeaderList>
Get the headers for the specified messages.
abstract
GetMessageHeaders (IList<string>, System.Threading.CancellationToken) : IList<MimeKit.HeaderList>
Get the headers for the specified messages. (Inherited from MailKit.MailSpool.)
override
GetMessageHeaders (int, System.Threading.CancellationToken) : MimeKit.HeaderList
Get the headers for the specified message.
abstract
GetMessageHeaders (int, System.Threading.CancellationToken) : MimeKit.HeaderList
Get the headers for the specified message. (Inherited from MailKit.MailSpool.)
override
GetMessageHeaders (string, System.Threading.CancellationToken) : MimeKit.HeaderList
Get the headers for the specified message.
abstract
GetMessageHeaders (string, System.Threading.CancellationToken) : MimeKit.HeaderList
Get the headers for the specified message. (Inherited from MailKit.MailSpool.)
override
GetMessageHeaders (int, int, System.Threading.CancellationToken) : IList<MimeKit.HeaderList>
Get the headers of the messages within the specified range.
abstract
GetMessageHeaders (int, int, System.Threading.CancellationToken) : IList<MimeKit.HeaderList>
Get the headers of the messages within the specified range. (Inherited from MailKit.MailSpool.)
GetMessageHeadersAsync (IList<int>, System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<MimeKit.HeaderList>>
Asynchronously get the headers for the specified messages. (Inherited from MailKit.MailSpool.)
GetMessageHeadersAsync (IList<string>, System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<MimeKit.HeaderList>>
Asynchronously get the headers for the specified messages. (Inherited from MailKit.MailSpool.)
GetMessageHeadersAsync (int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<MimeKit.HeaderList>
Asynchronously get the headers for the specified message. (Inherited from MailKit.MailSpool.)
GetMessageHeadersAsync (string, System.Threading.CancellationToken) : System.Threading.Tasks.Task<MimeKit.HeaderList>
Asynchronously get the headers for the specified message. (Inherited from MailKit.MailSpool.)
GetMessageHeadersAsync (int, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<MimeKit.HeaderList>>
Get the headers of the messages within the specified range. (Inherited from MailKit.MailSpool.)
override
GetMessages (IList<int>, System.Threading.CancellationToken) : IList<MimeKit.MimeMessage>
Get the messages at the specified indexes.
abstract
GetMessages (IList<int>, System.Threading.CancellationToken) : IList<MimeKit.MimeMessage>
Get the messages at the specified indexes. (Inherited from MailKit.MailSpool.)
override
GetMessages (IList<string>, System.Threading.CancellationToken) : IList<MimeKit.MimeMessage>
Get the messages with the specified UIDs.
abstract
GetMessages (IList<string>, System.Threading.CancellationToken) : IList<MimeKit.MimeMessage>
Get the messages with the specified UIDs. (Inherited from MailKit.MailSpool.)
override
GetMessages (int, int, System.Threading.CancellationToken) : IList<MimeKit.MimeMessage>
Get the messages within the specified range.
abstract
GetMessages (int, int, System.Threading.CancellationToken) : IList<MimeKit.MimeMessage>
Get the messages within the specified range. (Inherited from MailKit.MailSpool.)
GetMessagesAsync (IList<int>, System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<MimeKit.MimeMessage>>
Asynchronously get the messages at the specified indexes. (Inherited from MailKit.MailSpool.)
GetMessagesAsync (IList<string>, System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<MimeKit.MimeMessage>>
Asynchronously get the messages with the specified UIDs. (Inherited from MailKit.MailSpool.)
GetMessagesAsync (int, int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<MimeKit.MimeMessage>>
Asynchronously get the messages within the specified range. (Inherited from MailKit.MailSpool.)
override
GetMessageSize (int, System.Threading.CancellationToken) : int
Get the size of the specified message, in bytes.
abstract
GetMessageSize (int, System.Threading.CancellationToken) : int
Get the size of the specified message, in bytes. (Inherited from MailKit.MailSpool.)
override
GetMessageSize (string, System.Threading.CancellationToken) : int
Get the size of the specified message, in bytes.
abstract
GetMessageSize (string, System.Threading.CancellationToken) : int
Get the size of the specified message, in bytes. (Inherited from MailKit.MailSpool.)
GetMessageSizeAsync (int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<int>
Asynchronously get the size of the specified message, in bytes. (Inherited from MailKit.MailSpool.)
GetMessageSizeAsync (string, System.Threading.CancellationToken) : System.Threading.Tasks.Task<int>
Asynchronously get the size of the specified message, in bytes. (Inherited from MailKit.MailSpool.)
override
GetMessageSizes (System.Threading.CancellationToken) : IList<int>
Get the sizes for all available messages, in bytes.
abstract
GetMessageSizes (System.Threading.CancellationToken) : IList<int>
Get the sizes for all available messages, in bytes. (Inherited from MailKit.MailSpool.)
GetMessageSizesAsync (System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<int>>
Asynchronously get the sizes for all available messages, in bytes. (Inherited from MailKit.MailSpool.)
override
GetMessageUid (int, System.Threading.CancellationToken) : string
Get the UID of the message at the specified index.
abstract
GetMessageUid (int, System.Threading.CancellationToken) : string
Get the UID of the message at the specified index. (Inherited from MailKit.MailSpool.)
GetMessageUidAsync (int, System.Threading.CancellationToken) : System.Threading.Tasks.Task<string>
Asynchronously get the UID of the message at the specified index. (Inherited from MailKit.MailSpool.)
override
GetMessageUids (System.Threading.CancellationToken) : IList<string>
Get the full list of available message UIDs.
abstract
GetMessageUids (System.Threading.CancellationToken) : IList<string>
Get the full list of available message UIDs. (Inherited from MailKit.MailSpool.)
GetMessageUidsAsync (System.Threading.CancellationToken) : System.Threading.Tasks.Task<IList<string>>
Get the full list of available message UIDs. (Inherited from MailKit.MailSpool.)
override
NoOp (System.Threading.CancellationToken)
Ping the POP3 server to keep the connection alive.
abstract
NoOp (System.Threading.CancellationToken)
Pings the mail server to keep the connection alive. (Inherited from MailKit.MailService.)
NoOpAsync (System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously pings the mail server to keep the connection alive. (Inherited from MailKit.MailService.)
override
Reset (System.Threading.CancellationToken)
Reset the state of all messages marked for deletion.
abstract
Reset (System.Threading.CancellationToken)
Reset the state of all messages marked for deletion. (Inherited from MailKit.MailSpool.)
ResetAsync (System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously reset the state of all messages marked for deletion. (Inherited from MailKit.MailSpool.)
SetLanguage (string, System.Threading.CancellationToken)
Set the language used by the POP3 server for error messages.
SetLanguageAsync (string, System.Threading.CancellationToken) : System.Threading.Tasks.Task
Asynchronously set the language used by the POP3 server for error messages.

Protected Methods

override
Dispose (bool)
Releases the unmanaged resources used by the MailKit.Net.Pop3.Pop3Client and optionally releases the managed resources.
Dispose (bool)
Releases the unmanaged resources used by the MailKit.MailService and optionally releases the managed resources. (Inherited from MailKit.MailService.)
OnAuthenticated (string)
Raise the authenticated event. (Inherited from MailKit.MailService.)
OnConnected ()
Raise the connected event. (Inherited from MailKit.MailService.)
OnDisconnected ()
Raise the disconnected event. (Inherited from MailKit.MailService.)

Public Events

Authenticated Occurs when the client has been successfully authenticated. (Inherited from MailKit.MailService.)
Connected Occurs when the client has been successfully connected. (Inherited from MailKit.MailService.)
Disconnected Occurs when the client gets disconnected. (Inherited from MailKit.MailService.)

Explicitly Implemented Interface Members

IEnumerable.GetEnumerator Gets an enumerator for the messages in the folder. (Inherited from MailKit.MailSpool.)

Member Details

Pop3Client Constructor

Initializes a new instance of the MailKit.Net.Pop3.Pop3Client class.

Syntax

public Pop3Client ()

Remarks

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Pop3Client Constructor

Initializes a new instance of the MailKit.Net.Pop3.Pop3Client class.

Syntax

public Pop3Client (MailKit.IProtocolLogger protocolLogger)

Parameters

protocolLogger
The protocol logger.

Exceptions

Type Reason
ArgumentNullException protocolLogger is null.

Remarks

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Authenticate Method

Authenticates using the supplied credentials.

Syntax

public override void Authenticate (System.Net.ICredentials credentials, System.Threading.CancellationToken cancellationToken)

Parameters

credentials
The user's credentials.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentNullException credentials is null.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected or is already authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.Security.Authentication.AuthenticationException Authentication using the supplied credentials has failed.
MailKit.Security.SaslException A SASL authentication error occurred.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception An POP3 protocol error occurred.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
MailKit.Net.Pop3.Pop3CommandException A POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException An POP3 protocol error occurred.
MailKit.Security.AuthenticationException Authentication using the supplied credentials has failed.

Remarks

If the POP3 server supports the APOP authentication mechanism, then APOP is used.

If the APOP authentication mechanism is not supported and the server supports one or more SASL authentication mechanisms, then the SASL mechanisms that both the client and server support are tried in order of greatest security to weakest security. Once a SASL authentication mechanism is found that both client and server support, the credentials are used to authenticate.

If the server does not support SASL or if no common SASL mechanisms can be found, then the USER and PASS commands are used as a fallback.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

AuthenticationMechanisms Property

Gets the authentication mechanisms supported by the POP3 server.

Syntax

public override HashSet<string> AuthenticationMechanisms { get; }

Value

The authentication mechanisms.

Remarks

The authentication mechanisms are queried durring the Pop3Client.Connect(Uri, System.Threading.CancellationToken) method.

Servers that do not support the SASL capability will typically support either the "APOP" authentication mechanism (Pop3Capabilities.Apop) or the ability to login using the "USER" and "PASS" commands (Pop3Capabilities.User).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Capabilities Property

Gets the capabilities supported by the POP3 server.

Syntax

public Pop3Capabilities Capabilities { get; set; }

Value

The capabilities.

Exceptions

Type Reason
ArgumentException Capabilities cannot be enabled, they may only be disabled.

Remarks

The capabilities will not be known until a successful connection has been made via the Pop3Client.Connect(Uri, System.Threading.CancellationToken) method and may change as a side-effect of the Pop3Client.Authenticate(System.Net.ICredentials, System.Threading.CancellationToken) method.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Connect Method

Establishes a connection to the specified POP3 server.

Syntax

public override void Connect (Uri uri, System.Threading.CancellationToken cancellationToken)

Parameters

uri
The server URI. The Uri.Scheme should either be "pop" to make a clear-text connection or "pops" to make an SSL connection.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentNullException The uri is null.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is already connected.
MailKit.Net.Pop3.Pop3CommandException A POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.
ArgumentException The uri is not an absolute URI.

Remarks

Establishes a connection to an POP3 or POP3/S server. If the schema in the uri is "pop", a clear-text connection is made and defaults to using port 110 if no port is specified in the URI. However, if the schema in the uri is "pops", an SSL connection is made using the MailKit.MailService.ClientCertificates and defaults to port 995 unless a port is specified in the URI.

It should be noted that when using a clear-text POP3 connection, if the server advertizes support for the STLS extension, the client will automatically switch into TLS mode before authenticating unless the uri contains a query string to disable it.

If a successful connection is made, the Pop3Client.AuthenticationMechanisms and Pop3Client.Capabilities properties will be populated.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

DeleteAllMessages Method

Mark all messages for deletion.

Syntax

public override void DeleteAllMessages (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Messages marked for deletion are not actually deleted until the session is cleanly disconnected (see Pop3Client.Disconnect(bool, System.Threading.CancellationToken)).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

DeleteMessage Method

Mark the specified message for deletion.

Syntax

public override void DeleteMessage (int index, System.Threading.CancellationToken cancellationToken)

Parameters

index
The index of the message.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentOutOfRangeException index is not a valid message index.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Messages marked for deletion are not actually deleted until the session is cleanly disconnected (see Pop3Client.Disconnect(bool, System.Threading.CancellationToken)).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

DeleteMessage Method

Mark the specified message for deletion.

Syntax

public override void DeleteMessage (string uid, System.Threading.CancellationToken cancellationToken)

Parameters

uid
The UID of the message.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentNullException uid is null.
ArgumentException uid is not a valid message UID.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
NotSupportedException The POP3 server does not support the UIDL extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Messages marked for deletion are not actually deleted until the session is cleanly disconnected (see Pop3Client.Disconnect(bool, System.Threading.CancellationToken)).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

DeleteMessages Method

Mark the specified messages for deletion.

Syntax

public override void DeleteMessages (IList<int> indexes, System.Threading.CancellationToken cancellationToken)

Parameters

indexes
The indexes of the messages.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentNullException indexes is null.
ArgumentException

One or more of the indexes are invalid.

-or-

No indexes were specified.

ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Messages marked for deletion are not actually deleted until the session is cleanly disconnected (see Pop3Client.Disconnect(bool, System.Threading.CancellationToken)).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

DeleteMessages Method

Mark the specified messages for deletion.

Syntax

public override void DeleteMessages (IList<string> uids, System.Threading.CancellationToken cancellationToken)

Parameters

uids
The UIDs of the messages.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentNullException uids is null.
ArgumentException

One or more of the uids are invalid.

-or-

No uids were specified.

ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Messages marked for deletion are not actually deleted until the session is cleanly disconnected (see Pop3Client.Disconnect(bool, System.Threading.CancellationToken)).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

DeleteMessages Method

Mark the specified range of messages for deletion.

Syntax

public override void DeleteMessages (int startIndex, int count, System.Threading.CancellationToken cancellationToken)

Parameters

startIndex
The index of the first message to mark for deletion.
count
The number of messages to mark for deletion.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentOutOfRangeException startIndex and count do not specify a valid range of messages.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Messages marked for deletion are not actually deleted until the session is cleanly disconnected (see Pop3Client.Disconnect(bool, System.Threading.CancellationToken)).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Disconnect Method

Disconnect the service.

Syntax

public override void Disconnect (bool quit, System.Threading.CancellationToken cancellationToken)

Parameters

quit
If set to true, a "QUIT" command will be issued in order to disconnect cleanly.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.

Remarks

If quit is true, a "QUIT" command will be issued in order to disconnect cleanly.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Dispose Method

Releases the unmanaged resources used by the MailKit.Net.Pop3.Pop3Client and optionally releases the managed resources.

Syntax

protected override void Dispose (bool disposing)

Parameters

disposing
true to release both managed and unmanaged resources; false to release only the unmanaged resources.

Remarks

Releases the unmanaged resources used by the MailKit.Net.Pop3.Pop3Client and optionally releases the managed resources.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

EnableUTF8 Method

Enable UTF8 mode.

Syntax

public void EnableUTF8 (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException

The MailKit.Net.Pop3.Pop3Client is not connected.

-or-

The MailKit.Net.Pop3.Pop3Client has already been authenticated.

OperationCanceledException The operation was canceled via the cancellation token.
NotSupportedException The POP3 server does not support the UTF8 extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

The POP3 UTF8 extension allows the client to retrieve messages in the UTF-8 encoding and may also allow the user to authenticate using a UTF-8 encoded username or password.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

EnableUTF8Async Method

Asynchronously enable UTF8 mode.

Syntax

public System.Threading.Tasks.Task EnableUTF8Async (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Returns

An asynchronous task context.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException

The MailKit.Net.Pop3.Pop3Client is not connected.

-or-

The MailKit.Net.Pop3.Pop3Client has already been authenticated.

OperationCanceledException The operation was canceled via the cancellation token.
NotSupportedException The POP3 server does not support the UTF8 extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

The POP3 UTF8 extension allows the client to retrieve messages in the UTF-8 encoding and may also allow the user to authenticate using a UTF-8 encoded username or password.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

ExpirePolicy Property

Gets the expiration policy.

Syntax

public int ExpirePolicy { get; }

Value

The expiration policy.

Remarks

If the server supports the EXPIRE capability (Pop3Capabilities.Expire), the value of the Pop3Client.ExpirePolicy property will reflect the value advertized by the server.

A value of -1 indicates that messages will never expire.

A value of 0 indicates that messages that have been retrieved during the current session will be purged immediately after the connection is closed via the "QUIT" command.

Values larger than 0 indicate the minimum number of days that the server will retain messages which have been retrieved.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetEnumerator Method

Gets an enumerator for the messages in the folder.

Syntax

public override IEnumerator<MimeKit.MimeMessage> GetEnumerator ()

Returns

The enumerator.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
MailKit.Net.Pop3.Pop3CommandException A POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets an enumerator for the messages in the folder.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetLanguages Method

Get the list of languages supported by the POP3 server.

Syntax

public IList<Pop3Language> GetLanguages (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Returns

The supported languages.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
OperationCanceledException The operation was canceled via the cancellation token.
NotSupportedException The POP3 server does not support the LANG extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

If the POP3 server supports the LANG extension, it is possible to query the list of languages supported by the POP3 server that can be used for error messages.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetLanguagesAsync Method

Asynchronously get the list of languages supported by the POP3 server.

Syntax

Parameters

cancellationToken
The cancellation token.

Returns

The supported languages.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
OperationCanceledException The operation was canceled via the cancellation token.
NotSupportedException The POP3 server does not support the LANG extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

If the POP3 server supports the LANG extension, it is possible to query the list of languages supported by the POP3 server that can be used for error messages.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessage Method

Get the message at the specified index.

Syntax

public override MimeKit.MimeMessage GetMessage (int index, System.Threading.CancellationToken cancellationToken)

Parameters

index
The index of the message.
cancellationToken
The cancellation token.

Returns

The message.

Exceptions

Type Reason
ArgumentOutOfRangeException index is not a valid message index.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the message at the specified index.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessage Method

Get the message with the specified UID.

Syntax

public override MimeKit.MimeMessage GetMessage (string uid, System.Threading.CancellationToken cancellationToken)

Parameters

uid
The UID of the message.
cancellationToken
The cancellation token.

Returns

The message.

Exceptions

Type Reason
ArgumentNullException uid is null.
ArgumentException uid is not a valid message UID.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
NotSupportedException The POP3 server does not support the UIDL extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the message with the specified UID.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageCount Method

Get the number of messages available in the message spool.

Syntax

public override int GetMessageCount (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Returns

The number of available messages.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the number of messages available in the message spool.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageHeaders Method

Get the headers for the specified messages.

Syntax

public override IList<MimeKit.HeaderList> GetMessageHeaders (IList<int> indexes, System.Threading.CancellationToken cancellationToken)

Parameters

indexes
The indexes of the messages.
cancellationToken
The cancellation token.

Returns

The headers for the specified messages.

Exceptions

Type Reason
ArgumentNullException indexes is null.
ArgumentException

One or more of the indexes are invalid.

-or-

No indexes were specified.

ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the headers for the specified messages.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageHeaders Method

Get the headers for the specified messages.

Syntax

public override IList<MimeKit.HeaderList> GetMessageHeaders (IList<string> uids, System.Threading.CancellationToken cancellationToken)

Parameters

uids
The UIDs of the messages.
cancellationToken
The cancellation token.

Returns

The headers for the specified messages.

Exceptions

Type Reason
ArgumentNullException uids is null.
ArgumentException

One or more of the uids are invalid.

-or-

No uids were specified.

ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the headers for the specified messages.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageHeaders Method

Get the headers for the specified message.

Syntax

public override MimeKit.HeaderList GetMessageHeaders (int index, System.Threading.CancellationToken cancellationToken)

Parameters

index
The index of the message.
cancellationToken
The cancellation token.

Returns

The message headers.

Exceptions

Type Reason
ArgumentOutOfRangeException index is not a valid message index.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the headers for the specified message.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageHeaders Method

Get the headers for the specified message.

Syntax

public override MimeKit.HeaderList GetMessageHeaders (string uid, System.Threading.CancellationToken cancellationToken)

Parameters

uid
The UID of the message.
cancellationToken
The cancellation token.

Returns

The message headers.

Exceptions

Type Reason
ArgumentNullException uid is null.
ArgumentException uid is not a valid message UID.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
NotSupportedException The POP3 server does not support the UIDL extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the headers for the specified message.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageHeaders Method

Get the headers of the messages within the specified range.

Syntax

public override IList<MimeKit.HeaderList> GetMessageHeaders (int startIndex, int count, System.Threading.CancellationToken cancellationToken)

Parameters

startIndex
The index of the first message to get.
count
The number of messages to get.
cancellationToken
The cancellation token.

Returns

The headers of the messages within the specified range.

Exceptions

Type Reason
ArgumentOutOfRangeException startIndex and count do not specify a valid range of messages.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the headers of the messages within the specified range.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessages Method

Get the messages at the specified indexes.

Syntax

public override IList<MimeKit.MimeMessage> GetMessages (IList<int> indexes, System.Threading.CancellationToken cancellationToken)

Parameters

indexes
The indexes of the messages.
cancellationToken
The cancellation token.

Returns

The messages.

Exceptions

Type Reason
ArgumentNullException indexes is null.
ArgumentException

One or more of the indexes are invalid.

-or-

No indexes were specified.

ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Get the messages at the specified indexes.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessages Method

Get the messages with the specified UIDs.

Syntax

public override IList<MimeKit.MimeMessage> GetMessages (IList<string> uids, System.Threading.CancellationToken cancellationToken)

Parameters

uids
The UIDs of the messages.
cancellationToken
The cancellation token.

Returns

The messages.

Exceptions

Type Reason
ArgumentNullException uids is null.
ArgumentException

One or more of the uids are invalid.

-or-

No uids were specified.

ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the messages with the specified UIDs.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessages Method

Get the messages within the specified range.

Syntax

public override IList<MimeKit.MimeMessage> GetMessages (int startIndex, int count, System.Threading.CancellationToken cancellationToken)

Parameters

startIndex
The index of the first message to get.
count
The number of messages to get.
cancellationToken
The cancellation token.

Returns

The messages.

Exceptions

Type Reason
ArgumentOutOfRangeException startIndex and count do not specify a valid range of messages.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the messages within the specified range.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageSize Method

Get the size of the specified message, in bytes.

Syntax

public override int GetMessageSize (int index, System.Threading.CancellationToken cancellationToken)

Parameters

index
The index of the message.
cancellationToken
The cancellation token.

Returns

The message size, in bytes.

Exceptions

Type Reason
ArgumentOutOfRangeException index is not a valid message index.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the size of the specified message, in bytes.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageSize Method

Get the size of the specified message, in bytes.

Syntax

public override int GetMessageSize (string uid, System.Threading.CancellationToken cancellationToken)

Parameters

uid
The UID of the message.
cancellationToken
The cancellation token.

Returns

The message size, in bytes.

Exceptions

Type Reason
ArgumentNullException uid is null.
ArgumentException uid is not a valid message UID.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the size of the specified message, in bytes.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageSizes Method

Get the sizes for all available messages, in bytes.

Syntax

public override IList<int> GetMessageSizes (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Returns

The message sizes, in bytes.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Gets the sizes for all available messages, in bytes.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageUid Method

Get the UID of the message at the specified index.

Syntax

public override string GetMessageUid (int index, System.Threading.CancellationToken cancellationToken)

Parameters

index
The message index.
cancellationToken
The cancellation token.

Returns

The message UID.

Exceptions

Type Reason
ArgumentOutOfRangeException index is not a valid message index.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
NotSupportedException The POP3 server does not support the UIDL extension.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Not all servers support UIDs, so you should first check the Pop3Client.SupportsUids property.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

GetMessageUids Method

Get the full list of available message UIDs.

Syntax

public override IList<string> GetMessageUids (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Returns

The message uids.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
NotSupportedException The POP3 server does not support the UIDL extension.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Not all servers support UIDs, so you should first check the Pop3Client.SupportsUids property.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Implementation Property

Gets the implementation details of the server.

Syntax

public string Implementation { get; }

Value

The implementation details.

Remarks

If the server advertizes its implementation details, this value will be set to a string containing the information details provided by the server.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

IsConnected Property

Gets whether or not the client is currently connected to an POP3 server.

Syntax

public override bool IsConnected { get; }

Value

true if the client is connected; otherwise, false.

Remarks

When a MailKit.Net.Pop3.Pop3ProtocolException is caught, the connection state of the MailKit.Net.Pop3.Pop3Client should be checked before continuing.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

LoginDelay Property

Gets the minimum delay, in milliseconds, between logins.

Syntax

public int LoginDelay { get; }

Value

The login delay.

Remarks

If the server supports the LOGIN-DELAY capability (Pop3Capabilities.LoginDelay), this value will be set to the minimum number of milliseconds that the client must wait between logins.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

NoOp Method

Ping the POP3 server to keep the connection alive.

Syntax

public override void NoOp (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected or authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception The NOOP command failed.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Mail servers, if left idle for too long, will automatically drop the connection.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Protocol Property

Gets the protocol supported by the message service.

Syntax

protected override string Protocol { get; }

Value

The protocol.

Remarks

Gets the protocol supported by the message service.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Reset Method

Reset the state of all messages marked for deletion.

Syntax

public override void Reset (System.Threading.CancellationToken cancellationToken)

Parameters

cancellationToken
The cancellation token.

Exceptions

Type Reason
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3Exception A POP3 protocol error occurred.
UnauthorizedAccessException The MailKit.Net.Pop3.Pop3Client is not authenticated.
OperationCanceledException The operation was canceled via the cancellation token.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

Messages marked for deletion are not actually deleted until the session is cleanly disconnected (see Pop3Client.Disconnect(bool, System.Threading.CancellationToken)).

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

SetLanguage Method

Set the language used by the POP3 server for error messages.

Syntax

public void SetLanguage (string lang, System.Threading.CancellationToken cancellationToken)

Parameters

lang
The language code.
cancellationToken
The cancellation token.

Exceptions

Type Reason
ArgumentNullException lang is null.
ArgumentException lang is empty.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
OperationCanceledException The operation was canceled via the cancellation token.
NotSupportedException The POP3 server does not support the LANG extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

If the POP3 server supports the LANG extension, it is possible to set the language used by the POP3 server for error messages.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

SetLanguageAsync Method

Asynchronously set the language used by the POP3 server for error messages.

Syntax

public System.Threading.Tasks.Task SetLanguageAsync (string lang, System.Threading.CancellationToken cancellationToken)

Parameters

lang
The language code.
cancellationToken
The cancellation token.

Returns

An asynchronous task context.

Exceptions

Type Reason
ArgumentNullException lang is null.
ArgumentException lang is empty.
ObjectDisposedException The MailKit.Net.Pop3.Pop3Client has been disposed.
InvalidOperationException The MailKit.Net.Pop3.Pop3Client is not connected.
OperationCanceledException The operation was canceled via the cancellation token.
NotSupportedException The POP3 server does not support the LANG extension.
System.IO.IOException An I/O error occurred.
MailKit.Net.Pop3.Pop3CommandException The POP3 command failed.
MailKit.Net.Pop3.Pop3ProtocolException A POP3 protocol error occurred.

Remarks

If the POP3 server supports the LANG extension, it is possible to set the language used by the POP3 server for error messages.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

SupportsUids Property

Gets whether or not the MailKit.Net.Pop3.Pop3Client supports referencing messages by UIDs.

Syntax

public override bool SupportsUids { get; }

Value

true if supports UIDs; otherwise, false.

Remarks

Not all servers support referencing messages by UID, so this property should be checked before using Pop3Client.GetMessageUid(int, System.Threading.CancellationToken) and Pop3Client.GetMessageUids(System.Threading.CancellationToken).

If the server does not support UIDs, then all methods that take UID arguments along with Pop3Client.GetMessageUid(int, System.Threading.CancellationToken) and Pop3Client.GetMessageUids(System.Threading.CancellationToken) will fail.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

SyncRoot Property

Gets the lock object used by the default Async methods.

Syntax

public override object SyncRoot { get; }

Value

The lock object.

Remarks

Gets the lock object used by the default Async methods.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0

Timeout Property

Gets or sets the timeout for network streaming operations, in milliseconds.

Syntax

public override int Timeout { get; set; }

Value

The timeout in milliseconds.

Remarks

Gets or sets the underlying socket stream's System.IO.Stream.ReadTimeout and System.IO.Stream.WriteTimeout values.

Requirements

Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll)
Assembly Versions: 0.94.0.0, 0.96.0.0