public ActionResult ConfirmRegistration(int?id) { Session["bookID"] = id; Student studentApplication = db.students.Where(p => p.StID == id).FirstOrDefault(); var username = User.Identity.GetUserName(); var attachments = new List <Attachment>(); attachments.Add(new Attachment(new MemoryStream(GeneratePDF(id)), "Proof of registration", "application/pdf")); var mailTo = new List <MailAddress>(); mailTo.Add(new MailAddress(username, studentApplication.StudentName)); var body = $"Hello {studentApplication.StudentName}, \n\n {studentApplication.StudentName} has been successfully registered at our school. Please Find the attached registration information(Proof of Registration)<br/> Regards,<br/><br/> New Erra <br/> ."; DGSappSem2.Models.EmailService emailService = new DGSappSem2.Models.EmailService(); emailService.SendEmail(new EmailContent() { mailTo = mailTo, mailCc = new List <MailAddress>(), mailSubject = "Application Statement | Ref No.:" + studentApplication.StID, mailBody = body, mailFooter = "<br/> <br/> <b>New Erra</b>", mailPriority = MailPriority.High, mailAttachments = attachments }); TempData["AlertMessage"] = $"{studentApplication.StudentName} has been successfully Registered"; return(RedirectToAction("Index")); }
public static void SendAcceptanceEmail(Student studentApplication) { var mailTo = new List <MailAddress>(); mailTo.Add(new MailAddress(studentApplication.StudentEmail, studentApplication.StudentName)); var body = $"Good Day {studentApplication.StudentName}, \n\n Your application was successful. Please proceed to registration.<br/><br/> Thank you"; EmailService emailService = new EmailService(); emailService.SendEmail(new EmailContent() { mailTo = mailTo, mailCc = new List <MailAddress>(), mailSubject = "Acceptance into Durban Girls Secondary School", mailBody = body, mailFooter = "<br/> <br/> <b>Durban Girls Secondary School</b>", mailPriority = MailPriority.High, mailAttachments = new List <Attachment>() }); }
public static void SendApplicationEmail(Student studentApplication) { var mailTo = new List <MailAddress>(); mailTo.Add(new MailAddress(studentApplication.StudentEmail, studentApplication.StudentName)); var body = $"Good Day {studentApplication.StudentName}, \n\n We have received your application, please wait for approval." + $"<br/><br/> Thank you"; EmailService emailService = new EmailService(); emailService.SendEmail(new EmailContent() { mailTo = mailTo, mailCc = new List <MailAddress>(), mailSubject = "Application Feedback", mailBody = body, mailFooter = "<br/> <br/> <b>Durban Girls Secondary School</b>", mailPriority = MailPriority.High, mailAttachments = new List <Attachment>() }); }