private bool StartConnection()
 {
     if (!IsSmtpRunning)
     {
         ButtonSendMessage.Enabled = false;
         Service = new SmtpService();
         Service.PushNewConfig(SmtpConfig);
         Service.OnConnectionOpened   += OnSmtpConnectionEstablished;
         Service.OnConnectionClosed   += OnSmtpConnectionClosed;
         Service.OnLineSentOrReceived += ParseDebugMessage;
         try { Service.RequestStartService(); return(true); }
         catch (Exception E)
         {
             ButtonSendMessage.Enabled = true;
             MessageBox.Show("Could not connect to the server. Reason: " + E.ToString());
         }
     }
     else
     {
         throw new Exception("connection_exists");
     }
     return(false);
 }
 //on goodbye handshake
 private void OnCleanShutdown()
 {
     Service.RequestStopService();
     Service = null;
 }