ActionMailer .net mvc giving error, Value does not fall within the expected range

When i am sending mail using ActionMailer.Net.Mvc getting a error "Value does not fall within the expected range." below is code.

               var context = System.Web.HttpContext.Current;

                Task.Factory.StartNew(() =>
                    System.Web.HttpContext.Current = context;
                    new MailController().NewsLetter("", objNewsModel).Deliver();

    public class MailController : MailerBase
           public EmailResult NewsLetter(string EmailAddress, NewsModel objNewsModel)
                From = "";
                Subject = "Latest News";

                return Email("NewsLetter", objNewsModel); 
   //this (return Email("NewsLetter", objNewsModel);)line giving a error 'Value does not fall within the expected range.'


I tried your code with an empty custom view Newsletter.txt.cshtml and it works perfect. Try it with an empty view, maybe there is a problem displaying the items.

Please keep in mind also that the ActionMailer is not maintained.

Need Your Help

MySQL: Select specific strings and replace on several locations

mysql sql select replace

The table have several columns. One of them is 'video'. There are many rows, all cells contain one string. The string should get more accessories. They contain different names for the label and the...

Unit testing spring controllers - whether to use MockMvc or directly call methods

java spring unit-testing

While writing unit tests for a Spring controller, is it better to use MockMvc, or directly call the controller functions?