public async Task <IActionResult> FAQs(string email, string name, string message) { var command = new SendFaqCommand { Email = email, Name = name, Message = message }; var result = await _anonymousService.SendFaq(command); return(View()); }
public async Task <SendFaqResult> SendFaq(SendFaqCommand command) { var client = new SendGridClient(GetValueInSection("EmailConfig", "SendGridApiKey")); var from = new EmailAddress(GetValueInSection("EmailConfig", "SenderEmail"), GetValueInSection("EmailConfig", command.Name)); var to = new EmailAddress(GetValueInSection("FAQ", "Email"), GetValueInSection("FAQ", "ReceiverName")); var subject = GetValueInSection("FAQ", "Subject"); var msg = MailHelper.CreateSingleEmail( from, to, subject, command.Message + "\n From: " + command.Email, "" ); msg.SetClickTracking(false, false); var response = await client.SendEmailAsync(msg); return(new SendFaqResult { }); }