public async Task <IActionResult> TestSendMail() { string body = string.Empty; //string path = Path.Combine(Environment.CurrentDirectory, "\\Project\\bkc-backend\\bkc-backend.Api\\Views\\EmailTemplate\\EmailNoti.cshtml"); string path = "/Views/Share/EmailNotify.cshtml"; //using (StreamReader reader = new StreamReader(path)) //{ // body = reader.ReadToEnd(); //} body = await _razorViewToStringRenderer.RenderViewToStringAsync(path, new TemModel()); var mailContent = new MailContent(); mailContent.To = "*****@*****.**"; mailContent.Subject = "Test Email"; mailContent.Body = body; await _sendMailServices.SendMail(mailContent); return(Ok()); }
public IActionResult SendMail(MailContent mailContent) { _sendMailServices.SendMail(mailContent); return(Ok()); }