Esempio n. 1
0
        public async Task <IActionResult> Contact(Contact contact)
        {
            if (ModelState.IsValid && await _reCaptcha.ValidateResponse(Request.Form["g-recaptcha-response"]))
            {
                await _emailSender.SendEmailAsync($"{_settingsKeeper.GetSetting("GroupsEmailAddress").Value}", $"Message from {contact.Name}", $"{contact.Content}{Environment.NewLine}Sent by: {contact.Destination}");

                TempData["Error"] = false;
            }
            else
            {
                TempData["Error"] = true;
            }

            return(RedirectToAction("Contact"));
        }