Smtp.GetSupportedAuthMethods Method
SmtpGetSupportedAuthMethods Method
Returns a set of flags indicating which authentication methods are supported by the server.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public AuthenticationMethods GetSupportedAuthMethods()

Return Value

Type: AuthenticationMethods
A set of flags indicating which authentication methods are supported by the server, or None if Hello method has not yet been called or if the server does not support EHLO command (i.e. the server is not ESMTP enabled).
MailBeeInvalidStateExceptionThere are multiple or non-SMTP connections being opened at the moment (IsSmtpContext is false).
This sample lists all authentication methods supported by the SMTP server. SMTP servers do not support non-SASL methods, thus only SASL methods are checked.
// To use the code below, import these namespaces at the top of your code.
using System;
using MailBee;
using MailBee.SmtpMail;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();

AuthenticationMethods methods = mailer.GetSupportedAuthMethods();
if ( (methods & AuthenticationMethods.SaslLogin) > 0)
    Console.WriteLine("SASL LOGIN");
if ( (methods & AuthenticationMethods.SaslPlain) > 0)
    Console.WriteLine("SASL PLAIN");
if ( (methods & AuthenticationMethods.SaslCramMD5) > 0)
    Console.WriteLine("SASL CRAM-MD5 (secure)");

See Also