private void OnSendButtonClick(object sender, RoutedEventArgs e)
        {
            DataStorage.MailFrom   = LoginEdit.Text;
            DataStorage.MailTo     = RecipientEdit.Text;
            DataStorage.SmtpHost   = SmtpHostEdit.Text;
            DataStorage.SmtpPort   = Int32.Parse(PortEdit.Text);
            DataStorage.MsgSubject = SubjectEdit.Text;
            DataStorage.MsgBody    = BodyEdit.Text;
            DataStorage.Login      = LoginEdit.Text;
            NetworkCredential credential = new NetworkCredential
            {
                UserName       = DataStorage.Login,
                SecurePassword = PasswordEdit.SecurePassword
            };

            EmailSendServiceClass mailSender = new EmailSendServiceClass(credential);

            //var from = new MailAddress(DataStorage.MailFrom, DataStorage.NameFrom);
            //var to = new MailAddress(DataStorage.MailTo);

            //dsfadf
            //dfsf
            //dvdf
            //var message = new MailMessage(from, to)
            //{
            //    Subject = DataStorage.MsgSubject + DateTime.Now,
            //    Body = DataStorage.MsgBody + DateTime.Now
            //};


            //var client = new SmtpClient(DataStorage.SmtpHost, DataStorage.SmtpPort)
            //{
            //    EnableSsl = true,
            //    Credentials = new NetworkCredential
            //    {
            //        UserName = DataStorage.Login,
            //        SecurePassword = PasswordEdit.SecurePassword
            //    }
            //};



            //client.Send(message);

            mailSender.Send();
        }
        private void OnSendButtonClick(object sender, RoutedEventArgs e)
        {
            ConnectionData.ClientEmail    = tbSender.Text;
            ConnectionData.AddresseeEmail = tbAddressee.Text;

            EmailSendServiceClass sendService = new EmailSendServiceClass();

            sendService.SetupCredentials(tbLogin.Text, pbPassword.SecurePassword);
            sendService.SetupMessage(EmailSubjectTb.Text, EmailBodyTb.Text);
            try
            {
                sendService.SendMessage();
            }
            catch (SmtpException ex)
            {
                ErrorMessageWindow errorWindow =
                    new ErrorMessageWindow("Невозможно отправить письмо:\n" + ex.ToString());
                errorWindow.ShowDialog();
            }
            SendEndWindow endWindow = new SendEndWindow();

            endWindow.ShowDialog();
        }