public void TestReportingEmail(SendMailService sendMailService) { if (!Model.ReportingModel.ValidateAcceptance()) { MessageBox.ShowError(Dialog, "Please correct error conditions before sending a test email.", Core.Application.NameAndVersion); } else { try { var m = Model.ReportingModel; sendMailService.SendEmail(m.FromAddress, m.ToAddress, "HFM.NET - Test Email", "HFM.NET - Test Email", m.Server, m.Port, m.Username, m.Password, m.IsSecure); MessageBox.ShowInformation(Dialog, "Test email sent successfully.", Core.Application.NameAndVersion); } catch (Exception ex) { Logger.Warn(ex.Message, ex); var text = String.Format("Test email failed to send. Please check your email settings.{0}{0}Error: {1}", Environment.NewLine, ex.Message); MessageBox.ShowError(Dialog, text, Core.Application.NameAndVersion); } } }