Menu

How To Detect Ssl Type

As mentioned here Ssl (Implicit) smtp servers do the whole operation in an encrypted TCP connection, while Tls (Explicit) smtp servers start a plain text connection, does the hand shaking and then start an encrypted data transferring.

How to detect Ssl Type

To detect Ssl Type AIM will firstly tries to detect if it is a TLS (Explicit) connection. If not, it will try to connect to server as a Ssl Server, if both fails it will return None as ssl type

public SslMode DetectSslType(string host, string tlsPort, string user, string pass){
    var mailer = new MimeMailer(host, tlsPort)
    {
            User = user,
            Password = pass,
            AuthenticationMode = AuthenticationType.Base64
    };
    mailer.SendCompleted += compEvent;
    return mailer.DetectSslMode();
}

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);
    }
}

Related

Wiki: Home
Wiki: How To Detect Tls Support
Wiki: How to Detect if mail server is Tls or Ssl
Wiki: SSL VS TLS

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.