0

I am using MvcMailer for sending email in my project.

everything OK but when I send email in admin area, email is sent with admin area layout, and It doesn't use "~/View/UserMailer/_Layout.cshtml".

In Github of this project, some one discuss this issue but no one didn't has answered.

Does anyone have any idea?

Majid Basirati
  • 2,665
  • 3
  • 24
  • 46

1 Answers1

1

Rename the _Layout.cshtml in your mailer folder to something else such as _LayoutMailer.cshtml

Rename the MasterName in your mailer constructor in UserMailer.cs to the same as follows:

public class UserMailer : MailerBase
{
    public UserMailer()
    {
        MasterName = "_LayoutMailer";
    }
    ...
}
Majid Basirati
  • 2,665
  • 3
  • 24
  • 46
adam78
  • 9,668
  • 24
  • 96
  • 207