Majid Basirati
Majid Basirati

Reputation: 2855

MvcMailer Areas and _Layout Issue

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?

Upvotes: 0

Views: 95

Answers (1)

adam78
adam78

Reputation: 10068

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";
    }
    ...
}

Upvotes: 1

Related Questions