[HttpPost]
public IActionResult EmailSender(){
WebMail.SmtpServer = "smtp.gmail.com";
WebMail.EnableSsl = true;
WebMail.UserName = "[email protected]";
WebMail.Password = "password";
WebMail.SmtpPort = 587;
WebMail.Send("[email protected]", subject, [email protected] + "<br>", message);
return View();
}
This is my work on an ASP.Net Core MVC project.
I am trying to send an email from one email to another but there’s some error that occurs when I click on the send button, the app sends me to the line of “WebMail.Send(“[email protected]”, subject, [email protected] + “
“, message);” and says this error:
System.TypeLoadException: ‘Could not load type ‘System.Web.HttpContext’ from assembly ‘System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.’
What is the problem?
Am I missing something?
Pouya Ab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1