SmtpGetSupportedAuthMethods Method |
Returns a set of flags indicating which authentication methods are supported by the server.
Namespace: MailBee.SmtpMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax public AuthenticationMethods GetSupportedAuthMethods()
Public Function GetSupportedAuthMethods As AuthenticationMethods
Return Value
Type:
AuthenticationMethodsA 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).
Exceptions Examples 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.
using System;
using MailBee;
using MailBee.SmtpMail;
Smtp mailer = new Smtp();
mailer.SmtpServers.Add("mail.domain.com");
mailer.Connect();
mailer.Hello();
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)");
}
mailer.Disconnect();
Imports MailBee
Imports MailBee.SmtpMail
Dim mailer = New Smtp
mailer.SmtpServers.Add("mail.domain.com")
mailer.Connect()
mailer.Hello()
Dim methods As AuthenticationMethods = mailer.GetSupportedAuthMethods()
If ((methods And AuthenticationMethods.SaslLogin) > 0) Then
Console.WriteLine("SASL LOGIN")
End If
If ((methods And AuthenticationMethods.SaslPlain) > 0) Then
Console.WriteLine("SASL PLAIN")
End If
If ((methods And AuthenticationMethods.SaslCramMD5) > 0) Then
Console.WriteLine("SASL CRAM-MD5 (secure)")
End If
mailer.Disconnect()
See Also