asp.net-mvc-4 - HTML 帮助程序无法识别 "@Html.InlineImage"

标签 asp.net-mvc-4 email razor html-helper mvcmailer

我正在尝试在 MVCMailer 中嵌入电子邮件图像。 Github MvcMailer 分步指南确实提供了如下所示的解决方案:

分步指南:

//Place this in the View:
@Html.InlineImage("logo", "Company Logo")

//Place this in the mailer:
var resources = new Dictionary<string, string>();
resources["logo"] = logoPath;
PopulateBody(mailMessage, "WelcomeMessage", resources);

我的问题是, View 无法识别@Html.InlineImage。它可以识别其他 html 帮助程序,但不能识别“InlineImage”。事实上,当我输入 @Html 时,它永远不会出现在智能感知中。

我认为 MVC 4 不支持此功能。任何人都可以为我指出正确的方向并告诉我需要做什么才能使其正常工作吗?

最佳答案

我知道为时已晚,但我通过添加“@using Mvc.Mailer;”解决了这个问题在电子邮件 View 的顶部。

关于asp.net-mvc-4 - HTML 帮助程序无法识别 "@Html.InlineImage",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19300328/

相关文章:

c# - 未找到与请求 URI 匹配的操作

c# - 如何在 ASP.NET Core 2.0 中预编译 View ?

c# - 如何将模型对象或 Viewbag 传递给 Javascript?

.net - 为什么 Razor 声明性 @helper 方法中的 HtmlHelper 实例为 null?

c# - 通过 epplus 在 excel 中调用公式

asp.net-mvc-4 - 子文件夹中的 Controller ASP.Net MVC 4

javascript - 发布 anchor 标签值,并将 anchor 作为提交

php - 定时邮件提醒 if/else

Perl 电子邮件依赖项

Java Mail writeTo 和读回给出 Illegal semicolon 错误