Q:

Send mail in ASP MVC have Server Error

I'm have problem when practice send email in ASP MVC in tutorials:
How To Send Email In ASP.NET MVC. 
I think problem in class: 
public async Task<<ActionResult>ActionResult> Index(EmailFormModel model)
{
  todosomething
  return RedirectToAction("Sent");
}

When run website it show the below error: 

Solve:
Thanks to @Simon C.
So, based on your comments, you have a POST contact method, but no way to navigate to the page yet ( just navigating to home/contact in your browser will send a GET request and since you have a [HttpPost] attribute, the route won't match). I think you need to add a GET method to your home controller to get you there:
[HttpGet]
public ActionResult Contact()
{
    return View(new EmailFormModel());
}

This means when you first navigate to /home/contact, you will hit the above method. When you post your form back to your site, you will hit the Contact Method marked with [HttpPost].
Edit: As an aside, you will also need to add a method called Sent on your controller for when the email is sent successfully. The line return RedirectToAction("Sent"); will be looking for a method called Sent.

A:

So, based on your comments, you have a POST contact method, but no way to navigate to the page yet ( just navigating to home/contact in your browser will send a GET request and since you have a [HttpPost] attribute, the route won't match). I think you need to add a GET method to your home controller to get you there: 
    [HttpGet]
    public ActionResult Contact()
    {
        return View(new EmailFormModel());
    }

This means when you first navigate to /home/contact, you will hit the above method. When you post your form back to your site, you will hit the Contact Method marked with [HttpPost]. 
Edit: As an aside, you will also need to add a method called Sent on your controller for when the email is sent successfully. The line return RedirectToAction("Sent"); will be looking for a method called Sent.

