【发布时间】:2013-10-10 15:39:49
【问题描述】:
我正在尝试在 MVCMailer 中嵌入电子邮件图像。 Github MvcMailer Step by Step Guide 确实提供了如下所示的解决方案:
分步指南:
//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);
我的问题是,视图无法识别@Html.InlineImage。它识别其他 html 助手,而不是“InlineImage”。事实上,当我输入 @Html 时,它永远不会出现在 intellisense 中。
我认为这在 MVC 4 中不受支持。谁能指出我正确的方向并告诉我需要做什么才能使其正常工作?
【问题讨论】:
-
仅供参考,这是我收到的错误消息:编译器错误消息:CS1061:“System.Web.Mvc.HtmlHelper
”不包含“InlineImage”的定义并且没有扩展名可以找到接受“System.Web.Mvc.HtmlHelper ”类型的第一个参数的方法“InlineImage”(您是否缺少 using 指令或程序集引用?) -
确保您拥有该视图范围的真实配置。检查本地 web.config 文件内容。我们假设您已将相关的程序集引用包含到您的项目中。
标签: asp.net-mvc-4 email razor html-helper mvcmailer