private void SendFromDatabase_Click(object sender, EventArgs e) { try { Output.Text = string.Empty; DatabaseReaderService databaseReaderService = new DatabaseReaderService(); string messageBody = databaseReaderService.GetMessageBody(); EmailSender emailSender = new EmailSender(); emailSender.SendEmail(messageBody); Output.Text = "Sent email with body: " + Environment.NewLine + messageBody; } catch (Exception ex) { Output.Text = ex.ToString(); } }
private void Send_Click(object sender, EventArgs e) { try { Output.Text = string.Empty; FileReaderService fileReaderService = new FileReaderService(); fileReaderService.RegisterFormatReader(new XmlFormatReader()); fileReaderService.RegisterDefaultFormatReader(new FlatFileFormatReader()); string messageBody = fileReaderService.GetMessageBodyFromFile(_fileName); EmailSender emailSender = new EmailSender(); emailSender.SendEmail(messageBody); Output.Text = "Sent email with body: " + Environment.NewLine + messageBody; } catch (Exception ex) { Output.Text = ex.ToString(); } }