If you need to know what is TLS please have a look on SSL VS TLS
[TOC]
Firstly you need to establish a plain text tcp connection by calling of TestConnection() function in Smtp client (MimeMailer) and then check for SupportsTls, if it is true means server supports Tls Communications.
This function will connect to server in plain text mode, gets the supported commands and if finds the support of StartTls will issue it.
private bool IsTls(string host, string tlsPort, string user, string pass) { var mailer = new MimeMailer(host, tlsPort, user, pass) { SslType = SslMode.Auto, AuthenticationMode = AuthenticationType.Base64 }; mailer.SendCompleted += compEvent; mailer.TestConnection(); return mailer.SupportsTls; } private void compEvent(object sender, AsyncCompletedEventArgs e) if (e.UserState != null) Console.Out.WriteLine(e.UserState.ToString()); if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!e.Cancelled) { MessageBox.Show("Send successfull!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
Note: Do not forget that the SslType should be auto.
Note: AuthentificationType depends on your server.
Wiki: Home
Wiki: How To Detect Ssl Type
Wiki: How to Detect if mail server is Tls or Ssl
Wiki: SSL VS TLS
Wiki: Send Mime Mails to Implicit Ssl Smtp Mail Servers