0

I'm using MVC 4 on both local and production. From my Index.cshtml file I have a simple link:

@Html.ActionLink("Click to send an email", "Email", "Home");

where Email is defined in my HomeController as:

public ActionResult Email() 
{

    // send mail
    MailMessage message = new MailMessage();

    message.From = new MailAddress("email@email.com");
    message.To.Add(new MailAddress("tony@email.com"));

    message.Subject = "User submitted a message...";

    string msgBody = "<html><body>" 
                    + "You have a new user submitted form request sent at " 
                    + DateTime.Now + ": 

    message.Body = msgBody;
    SmtpClient client = new SmtpClient();
    client.Send(message);

    return RedirectToAction("Index");

}

I have removed the client's email address and other details, but that's the basic gist of things. There is no "Email" view in particular, it just sends an email using system.net and returns home.

This works smoothly in Visual Web Express locally, on Arvixe hosting it generates a "Resource cannot be found" exception.

tereško
  • 58,060
  • 25
  • 98
  • 150
TonyMack
  • 9
  • 6
  • 2
    Can you post a screenshot of the error message? Or at least post the error message in full... – Richard A. Jan 15 '13 at 14:50
  • Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Home/Email Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18010 – TonyMack Jan 15 '13 at 15:26

0 Answers0