Пример #1
0
        public async Task <IActionResult> SendMessage([FromServices] ContactEmailService contactEmailService,
                                                      string name,
                                                      string fromEmail,
                                                      string message)
        {
            try
            {
                await contactEmailService.SendContactFromSite(name, fromEmail, message, "*****@*****.**");

                await contactEmailService.SendSubscriberEmailAsync(name, fromEmail, message);

                TempData["SuccessMessage"] = "Your message has been sent. Thanks for stopping by!";
            }
            catch
            {
                TempData["ErrorMessage"] = "Error trying to send your message. Please, try again later or send an email to [email protected]";
            }

            return(RedirectToAction("Index"));
        }