-
Notifications
You must be signed in to change notification settings - Fork 166
Description
Followed the instruction from
http://hangfire.readthedocs.io/en/latest/tutorials/send-email.html
[HttpPost]
public IHttpActionResult SendPostal([FromBody] MyMailModel objModelMail)
{
if (ModelState.IsValid)
{
try
{
var email = new NewCommentEmail
{
To = objModelMail.To,
UserName = objModelMail.Subject,
Comment = objModelMail.Body
};
email.Send();
}
catch (Exception e)
{
return Ok(e);
}
}
return Ok("Email sent");
}
Got an exception:
{
"ClassName": "System.ArgumentNullException",
"Message": "Value cannot be null.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.Web.HttpBrowserCapabilitiesWrapper..ctor(HttpBrowserCapabilities httpBrowserCapabilities)\r\n at System.Web.HttpRequestWrapper.get_Browser()\r\n at System.Web.WebPages.BrowserHelpers.GetOverriddenBrowser(HttpContextBase httpContext, Func2 createBrowser)\r\n at System.Web.WebPages.DisplayModeProvider.<.ctor>b__2(HttpContextBase context)\r\n at System.Web.WebPages.DefaultDisplayMode.CanHandleContext(HttpContextBase httpContext)\r\n at System.Web.WebPages.DisplayModeProvider.<GetAvailableDisplayModesForContext>d__4.MoveNext()\r\n at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations)\r\n at System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache)\r\n at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass6.<FindView>b__4(IViewEngine e)\r\n at System.Web.Mvc.ViewEngineCollection.Find(Func
2 lookup, Boolean trackSearchedPaths)\r\n at System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext controllerContext, String viewName, String masterName)\r\n at Postal.EmailViewRenderer.CreateView(String viewName, ControllerContext controllerContext)\r\n at Postal.EmailViewRenderer.Render(Email email, String viewName)\r\n at Postal.EmailService.Send(Email email)\r\n at Postal.Email.Send()\r\n at MyTestApp.Controllers.EmailController.SendPostal(MyMailModel objModelMail)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": "1\n.ctor\nSystem.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\nSystem.Web.HttpBrowserCapabilitiesWrapper\nVoid .ctor(System.Web.HttpBrowserCapabilities)",
"HResult": -2147467261,
"Source": "System.Web",
"WatsonBuckets": null,
"ParamName": "httpBrowserCapabilities"
}