private static void SendAllReportsInMailForThread(Therapist therapist) { try { MailMessage mail = new MailMessage(); mail.From = new MailAddress(SystemEmail); mail.To.Add(therapist.Email); mail.Subject = therapist.FirstName + " " + therapist.LastName + ": All Patients Reports"; mail.Body = "All patients reports are attached as requested.\nIf the file is not displaying correctly, please open it via Google Docs or Notpad."; string[] patientsFiles = Directory.GetFiles(PinchConstants.PatientsDirectoryPath); foreach (string file in patientsFiles) { Patient patient = QuestFileManager.GetPatientFromFile(file); Attachment attachment = new Attachment(ReportsManager.GetPatientReport(patient), patient.Id + ReportExtention); mail.Attachments.Add(attachment); } SmtpServer.Send(mail); } catch (Exception e) { PrintToLog(e.ToString(), LogType.Error); } }
private static void SendPatientReportInMailForThread(Therapist therapist, Patient patient) { try { MailMessage mail = new MailMessage(); mail.From = new MailAddress(SystemEmail); mail.To.Add(therapist.Email); mail.Subject = therapist.FirstName + " " + therapist.LastName + ": Patient Report"; mail.Body = "Report of patient: " + patient.FullName + ", id: " + patient.Id + ", is attached as requested.\nIf the file is not displaying correctly, please open it via Google Docs or Notpad."; Attachment attachment = new Attachment(ReportsManager.GetPatientReport(patient), patient.Id + ReportExtention); mail.Attachments.Add(attachment); SmtpServer.Send(mail); } catch (Exception e) { PrintToLog(e.ToString(), LogType.Error); } }