gpt4 book ai didi

asp.net-mvc-3 - "using Mvc.Mailer;"错误

转载 作者:行者123 更新时间:2023-12-04 03:34:18 25 4
gpt4 key购买 nike

我正在尝试使用 MvcMailer 在我的 MVC3 应用程序中发送电子邮件。

我已经成功安装了软件包 MvcMailer

使用引用 Unable to install MvcMailer并按照步骤

但是在使用的过程中出现了错误。使用 Mvc.Mailer;找不到类型或命名空间名称“MailerBase”(是否缺少 using 指令或程序集引用?)

我在下面的代码中提到错误作为注释。

using Mvc.Mailer;  //The type or namespace name 'Mvc' could not be found (are you missing a using directive or an assembly reference?)

namespace MvcApplicationMvcMailer.Mailers
{
public class UserMailer : MailerBase, IUserMailer //The type or namespace name 'MailerBase' could not be found (are you missing a using directive or an assembly reference?)
{
public UserMailer()
{
MasterName="_Layout";
}

public virtual MvcMailMessage Welcome()
{
//ViewBag.Data = someObject;
return Populate(x =>
{
x.Subject = "Welcome";
x.ViewName = "Welcome";
x.To.Add("some-email@example.com");
});
}

public virtual MvcMailMessage GoodBye()
{
//ViewBag.Data = someObject;
return Populate(x =>
{
x.Subject = "GoodBye";
x.ViewName = "GoodBye";
x.To.Add("some-email@example.com");
});
}
}
}

最佳答案

所需的 MvcMailer 包和版本取决于 您正在使用的 MVC.NET 版本:

ASP.NET MVC3

Install-Package MvcMailer3

ASP.NET MVC4 与 .NET 4

Install-Package MvcMailer -Version 4.0

ASP.NET MVC4 与 .NET 4.5

Install-Package MvcMailer

当 MVC5 和 .NET 5 出现时,这可能会再次改变。

关于asp.net-mvc-3 - "using Mvc.Mailer;"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18821843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com