我正在尝试在 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/