Pop3TlsStarted Event |
Namespace: MailBee.Pop3Mail
using System; using MailBee; using MailBee.Pop3Mail; using MailBee.Security; class Sample { // TlsStarted event handler. private static void OnTlsStarted(object sender, TlsStartedEventArgs e) { // This will happen during Login method execution. Console.WriteLine("TLS/SSL session started."); } // The actual code. static void Main(string[] args) { Pop3 pop = new Pop3(); // Subscribe to TlsStarted event. pop.TlsStarted += new TlsStartedEventHandler(OnTlsStarted); // Notify MailBee it should start TLS/SSL session when appropriate. // The connection is made to the regular port so that STLS command // will be used to start TLS/SSL session. pop.SslMode = SslStartupMode.UseStartTls; pop.Connect("mail.domain.com"); Console.WriteLine("Connected to the server. Will login now..."); // TLS/SSL negotiation will take place here. Thus, user credentials // will be sent to the mail server already under secure TLS/SSL layer. pop.Login("jdoe@domain.com", "secret"); Console.WriteLine("Logged in successfully."); pop.Disconnect(); } }