2

I am trying to embed an email image in MVCMailer. The Github MvcMailer Step by Step Guide does provide a solution as shown below:

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);

My problem is, the view does not recognize the @Html.InlineImage. It recognizes other html helpers, just not "InlineImage". In fact, it never comes in intellisense when I type @Html.

I think that this is not supported in MVC 4. Can anyone point me in the right direction and tell me what I need to do to get this working?

Amirhossein Mehrvarzi
  • 18,024
  • 7
  • 45
  • 70
user2789697
  • 227
  • 1
  • 7
  • 13
  • FYI, Here is the error message I'm getting: Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'InlineImage' and no extension method 'InlineImage' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) – user2789697 Oct 10 '13 at 15:48
  • Make sure you have true configurations for that view scope. Check the local **web.config** file contents. And we suppose you have included related assembly references to your project. – Amirhossein Mehrvarzi Feb 14 '14 at 08:45

2 Answers2

4

I know it's too late, but I solved it adding "@using Mvc.Mailer;" at the top of the email View.

Oscar Mateu
  • 789
  • 3
  • 10
  • 22
0

I did not figure out the @Html.InlineImage issue, but I did find a work around. Simply using: <img style="width: 243px; height: 91px" src="cid:logo" alt="Logo"/> in my view took care of the problem. Thank you all for looking to help.

user2789697
  • 227
  • 1
  • 7
  • 13