smsohan / MvcMailer

A Mailer for ASP.Net MVC that forms the Email Body using MVC Views (Razor etc.) following Ruby on Rails ActionMailer style
MIT License
585 stars 176 forks source link

mailMessage giving error #133

Closed ghost closed 10 years ago

ghost commented 10 years ago

var resources = new Dictionary<string, string>(); resources["logo"] = logoPath; PopulateBody(mailMessage, "WelcomeMessage", resources)

as per explain. I am getting a error on the mailMessage variable

"Does not exist in its current context"

mailer

ghost commented 10 years ago

I added var mailMessage = new MailMessage { Subject = "Welcome To the Site" };

which I guess is obvious. But the documentation i think is found wanting.

Would it not be better to properly layout the

"Embed Image or LinkedResource Inside Email" https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide#embed-image-or-linkedresource-inside-email

section. I wanted to add an image which is so easy to do but the current documentation ( maybe its just me ) does not seem to explain this simplicity at all.

I Am not sure if this is from an older version of the mailer but

var resources = new Dictionary<string, string>(); resources["logo"] = logoPath; PopulateBody(mailMessage, "WelcomeMessage", resources);

does not return an image. Not with the current scaffolding. it is even easier in its current form to create the resource and add it to the return.

like so return Populate(x => { x.Subject = "Welcome"; x.ViewName = "Welcome"; x.LinkedResources = resources; x.To.Add("derp@gmail.com"); });

With the resources referencing var resources = new Dictionary<string, string>(); resources["logo"] = logoPath;