Open GeorgeJohn opened 12 years ago
Are you using is offline or on a background job? The MailerBase subclass needs to be in a web project and need to run under a web server just like
Sohan http://smsohan.com skype:smsohan | gtalk:sohan39 | cell: 403-714-2673
On Tue, May 8, 2012 at 2:04 PM, GeorgeJohn < reply@reply.github.com
wrote:
Have an MVC project that uses a few webforms in it - we are in the process of converting them over. One of the pages happens to render a report. I'm trying to add the ability to email the report if the user wants to. When trying to use MvcMailer to achieve this it seems that it cannot find the view when I try to make the "PopulateBody" call
Here is my code from the UserMailer class
public class UserMailer : MailerBase, IUserMailer { ///
/// Email Reports using this method ///
/// The address to send to. /// The name of the view. ///
The mail message public MailMessage SendReport(string toAddress, string viewName) { var message = new MailMessage { Subject = "Report Mail" }; message.To.Add(toAddress);ViewBag.Name = "Testing-123"; this.PopulateBody(mailMessage: message, viewName: "SendReport"); return message;
} }
Every time I hit the populateBody call it responds with "Value cannot be null. Parameter name: routeData"
Any suggestions to overcome this would be quite helpful.
Reply to this email directly or view it on GitHub: https://github.com/smsohan/MvcMailer/issues/46
No, not using it offline or on a background job. I have an aspx page that is creating my report for me that I want to attach to the mail. In there I call the SendReport method in the UserMailer. I can step through all the way to the PopulateBody method and there I get this error.
Mvc.Mailer is referenced in the web project. Are you suggesting that I need to add the actual MailerBase into my web project? Sorry just trying to clarify what you are suggesting.
Sohan http://smsohan.com skype:smsohan | gtalk:sohan39 | cell: 403-714-2673
On Tue, May 8, 2012 at 3:56 PM, GeorgeJohn < reply@reply.github.com
wrote:
No, not using it offline or on a background job. I have an aspx page that is creating my report for me that I want to attach to the mail. In there I call the SendReport method in the UserMailer. I can step through all the way to the PopulateBody method and there I get this error.
Mvc.Mailer is referenced in the web project. Are you suggesting that I need to add the actual MailerBase into my web project? Sorry just trying to clarify what you are suggesting.
Reply to this email directly or view it on GitHub: https://github.com/smsohan/MvcMailer/issues/46#issuecomment-5587644
No worries. Thanks for the quick response. If it helps I also put together a test project where I just have a button on an aspx page and that in turn is just trying to call the welcome method in the UserMailer class. I get the same issue there as well. If you need me to zip up the project and send it to you I'd be more than happy to do so.
Were you ever able to look at this?
Have an MVC project that uses a few webforms in it - we are in the process of converting them over. One of the pages happens to render a report. I'm trying to add the ability to email the report if the user wants to. When trying to use MvcMailer to achieve this it seems that it cannot find the view when I try to make the "PopulateBody" call
Here is my code from the UserMailer class
public class UserMailer : MailerBase, IUserMailer { ///
}
Every time I hit the populateBody call it responds with "Value cannot be null. Parameter name: routeData"
Any suggestions to overcome this would be quite helpful.