MailBee.NET Objects 7.2

Imap.GetSupportedAuthMethods Method 

Returns a set of flags indicating which authentication methods are supported by the server.

public AuthenticationMethods GetSupportedAuthMethods();

Return Value

A set of flags indicating which authentication methods are supported by the server.

Remarks

If the IMAP4 server advertises LOGINDISABLED capability, regular authentication may not be supported by the server. However, this often indicates the client should call StartTls method to establish TLS/SSL secure connection. After that, regular authentication option will become available.

Exceptions

Exception Type Condition
MailBeeException An error occurred and ThrowExceptions is true.

Example

This sample indicates whether NTLM authentication (also known as Secure Password Authentication - SPA) is supported by the server.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.ImapMail;

// The actual code (put it into a method of your class).
Imap imp = new Imap();
imp.Connect("mail.domain.com");
AuthenticationMethods authMethods = imp.GetSupportedAuthMethods();

if ((authMethods & AuthenticationMethods.SaslNtlm) > 0)
{
    Console.WriteLine("NTLM secure authentication (SPA) is supported");
}
else
{
    Console.WriteLine("The IMAP4 server does not support NTLM (SPA)");
}
imp.Disconnect();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.ImapMail

' The actual code (put it into a method of your class).
Dim imp As New Imap
imp.Connect("mail.domain.com")
Dim authMethods As AuthenticationMethods = imp.GetSupportedAuthMethods()

If ((authMethods And AuthenticationMethods.SaslNtlm) > 0) Then
    Console.WriteLine("NTLM secure authentication (SPA) is supported")
Else
    Console.WriteLine("The IMAP4 server does not support NTLM (SPA)")
End If
imp.Disconnect()

See Also

Imap Class | MailBee.ImapMail Namespace | GetExtensions