Not sure if anyone else has run into this issue but I'm trying to send emails using MVCMailer. I was able to get it installed and updated the T4Scaffolding package without any issues.
I have an aspx page that is creating a report and I want that report attached to the email. However, when I turn around and call my SendReport method in the UserMailers class it throws an error on the PopulateBody call saying that routeData is null
Here is my code
public class UserMailer : MailerBase, IUserMailer
{
/// <summary>
/// Email Reports using this method
/// </summary>
/// <param name="toAddress">The address to send to.</param>
/// <param name="viewName">The name of the view.</param>
/// <returns>The mail message</returns>
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;
}
}
The error I get is "Value cannot be null. Parameter name: routeData"
I've looked online and haven't found anything that is related to this issue or anyone who has run into this problem.