public IActionResult Contact(ContactViewModel contactViewModel) { //Model State is not valid or emulate a failure if (!ModelState.IsValid || contactViewModel.FailMail) { logger.LogWarning($"Model is not valid: {contactViewModel.ToString()}"); ViewBag.MailSent = false; } else { //Conceptual Builder emailService.AddBody($"From: {contactViewModel.Name}, Message: {contactViewModel.Message}") .AddFromAddress(contactViewModel.Email) .AddSubject(contactViewModel.Subject) .AddToAddress("*****@*****.**") .SendMail(); ModelState.Clear(); ViewBag.MailSent = true; ViewBag.MailDetails = emailService.ToString(); } return(View()); }