This is not possible at the moment, although adding this feature to one of the future releases sounds like a good idea!
However, analyzing the SMTP communication to detect this is not very hard. You can use the following class for this purpose:
C#:
public class AuthenticationMethodDetector
{
public static SmtpAuthentication Login(Smtp smtp, string userName, string password, SmtpAuthentication method)
{
AuthenticationMethodDetector detector = new AuthenticationMethodDetector();
SmtpCommandSentEventHandler commandSent = new SmtpCommandSentEventHandler(detector.smtp_CommandSent);
smtp.CommandSent += commandSent;
try
{
smtp.Login(userName, password, method);
return detector._method;
}
finally
{
smtp.CommandSent -= commandSent;
}
}
private SmtpAuthentication _method;
private void smtp_CommandSent(object sender, SmtpCommandSentEventArgs e)
{
string command = e.Command;
if (command.StartsWith("AUTH "))
{
int n = command.IndexOf(' ', 5);
if (n < 0)
n = command.Length;
string method = command.Substring(5, n - 5);
switch (method)
{
case "CRAM-MD5":
_method = SmtpAuthentication.CramMD5;
break;
case "DIGEST-MD5":
_method = SmtpAuthentication.DigestMD5;
break;
case "PLAIN":
_method = SmtpAuthentication.Plain;
break;
case "LOGIN":
_method = SmtpAuthentication.Login;
break;
case "NTLM":
_method = SmtpAuthentication.Ntlm;
break;
case "GSSAPI":
_method = SmtpAuthentication.GssApi;
break;
default:
throw new InvalidOperationException("Unexpected authentication method.");
}
}
}
}
Then, instead of calling smtp.Login(userName, password, method), call AuthenticationMethodDetector.Login - it returns the selected authentication method.
If you prefer VB.NET, please let me know!