 | Pop3Capabilities Enumeration |
Capabilities supported by a POP3 server.
Namespace: MailKit.Net.Pop3Assembly: MailKit (in MailKit.dll) Version: 4.10.0
Syntax[FlagsAttribute]
public enum Pop3Capabilities
MembersMember name | Value | Description |
---|
None | 0 |
The server does not support any additional extensions.
|
Apop | 1 |
The server supports APOP
authentication.
|
Expire | 2 |
The server supports the EXPIRE extension
and defines the expiration policy for messages (see ExpirePolicy).
|
LoginDelay | 4 |
The server supports the LOGIN-DELAY extension,
allowing the server to specify to the client a minimum number of seconds between login attempts
(see LoginDelay).
|
Pipelining | 8 |
The server supports the PIPELINING extension,
allowing the client to batch multiple requests to the server at at time.
|
ResponseCodes | 16 |
The server supports the RESP-CODES extension,
allowing the server to provide clients with extended information in error responses.
|
Sasl | 32 |
The server supports the SASL authentication
extension, allowing the client to authenticate using the advertized authentication mechanisms
(see AuthenticationMechanisms).
|
StartTLS | 64 |
The server supports the STLS extension,
allowing clients to switch to an encrypted SSL/TLS connection after connecting.
|
Top | 128 |
The server supports the TOP command,
allowing clients to fetch the headers plus an arbitrary number of lines.
|
UIDL | 256 |
The server supports the UIDL command,
allowing the client to refer to messages via a UID as opposed to a sequence ID.
|
User | 512 |
The server supports the USER
authentication command, allowing the client to authenticate via a plain-text username
and password command (not recommended unless no other authentication mechanisms exist).
|
UTF8 | 1,024 |
The server supports the UTF8 extension,
allowing clients to retrieve messages in the UTF-8 encoding.
|
UTF8User | 2,048 |
The server supports the UTF8=USER extension,
allowing clients to authenticate using UTF-8 encoded usernames and passwords.
|
Lang | 4,096 |
The server supports the LANG extension,
allowing clients to specify which language the server should use for error strings.
|
Remarks
Capabilities are read as part of the response to the
CAPA command that
is issued during the connection and authentication phases of the
Pop3Client.
Examplepublic static void PrintCapabilities ()
{
using (var client = new Pop3Client ()) {
client.Connect ("pop.gmail.com", 995, SecureSocketOptions.SslOnConnect);
if (client.Capabilities.HasFlag (Pop3Capabilities.SASL)) {
var mechanisms = string.Join (", ", client.AuthenticationMechanisms);
Console.WriteLine ("The POP3 server supports the following SASL mechanisms: {0}", mechanisms);
}
client.Authenticate ("username", "password");
if (client.Capabilities.HasFlag (Pop3Capabilities.Apop))
Console.WriteLine ("The server supports APOP authentication.");
if (client.Capabilities.HasFlag (Pop3Capabilities.Expire)) {
if (client.ExpirePolicy > 0)
Console.WriteLine ("The POP3 server automatically expires messages after {0} days", client.ExpirePolicy);
else
Console.WriteLine ("The POP3 server will never expire messages.");
}
if (client.Capabilities.HasFlag (Pop3Capabilities.LoginDelay))
Console.WriteLine ("The minimum number of seconds between login attempts is {0}.", client.LoginDelay);
if (client.Capabilities.HasFlag (Pop3Capabilities.Pipelining))
Console.WriteLine ("The POP3 server can pipeline commands, so using client.GetMessages() will be faster.");
if (client.Capabilities.HasFlag (Pop3Capabilities.Top))
Console.WriteLine ("The POP3 server supports the TOP command, so it's possible to download message headers.");
if (client.Capabilities.HasFlag (Pop3Capabilities.UIDL))
Console.WriteLine ("The POP3 server supports the UIDL command which means we can track messages by UID.");
client.Disconnect (true);
}
}
See Also