public IActionResult SendEmail(PassengerInfoViewModel passengerInfo) { StringBuilder sb = FormatBody(); MailMessage mail = new MailMessage(); mail.To.Add(passengerInfo.ConfirmEmail); mail.From = new MailAddress(EmailFormating.EmailSender); mail.Subject = EmailFormating.EmailSubject; string Body = sb.ToString().Trim(); mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = EmailFormating.EmailHost; smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential(EmailFormating.EmailSender, EmailFormating.EmailSenderPassworfd); // Enter seders User name and password smtp.EnableSsl = true; smtp.Send(mail); SaveData(passengerInfo.ConfirmEmail); return(View("ThanksForReservation")); }
public IActionResult ProcessPassengerInfo(PassengerInfoViewModel passengerInfo) { ModelClass.Passengers.Add(passengerInfo); ModelClass.PassengersCount -= 1; return(RedirectToAction("RegisterPassengers", "Reservations")); }