Pop 3ClientAuthentication Mechanisms Property
Gets the authentication mechanisms supported by the POP3 server.
Definition
Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
The authentication mechanisms.
IMailServiceAuthenticationMechanisms
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public override HashSet<string> AuthenticationMechanisms { get; }Property Value
HashSetStringThe authentication mechanisms.
Implements
IMailServiceAuthenticationMechanismsIMailServiceAuthenticationMechanisms
Remarks
The authentication mechanisms are queried as part of the connection process.
Servers that do not support the SASL capability will typically support either the APOP authentication mechanism (Apop) or the ability to login using the USER and PASS commands (User).
Example
C#
public static void PrintCapabilities ()
{
using (var client = new Pop3Client ()) {
client.Connect ("pop.gmail.com", 995, SecureSocketOptions.SslOnConnect);
if (client.Capabilities.Contains (Pop3Capability.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.Contains (Pop3Capability.Apop))
Console.WriteLine ("The server supports APOP authentication.");
if (client.Capabilities.Contains (Pop3Capability.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.Contains (Pop3Capability.LoginDelay))
Console.WriteLine ("The minimum number of seconds between login attempts is {0}.", client.LoginDelay);
if (client.Capabilities.Contains (Pop3Capability.Pipelining))
Console.WriteLine ("The POP3 server can pipeline commands, so using client.GetMessages() will be faster.");
if (client.Capabilities.Contains (Pop3Capability.Top))
Console.WriteLine ("The POP3 server supports the TOP command, so it's possible to download message headers.");
if (client.Capabilities.Contains (Pop3Capability.UIDL))
Console.WriteLine ("The POP3 server supports the UIDL command which means we can track messages by UID.");
client.Disconnect (true);
}
}