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
584 stars 178 forks source link

No Body Rendered in Email #41

Closed steve99 closed 12 years ago

steve99 commented 12 years ago

Hi,

I have got this working correctly in one project where I keep everything together. In the second I created a separate project which I scaffolded the mailers in and created a class which is called from my main controller. It does not raise any errors using PopulateBody(mailMessage, viewName: "CreateNbus"); and it generates an email however the body is empty (other dynamic data is fine). I am writing the email file to disk.

I tried dropping out the master line in the class per another post but this didn't work. I also tried PopulateHtmlBody(mailMessage, "CreateNbus", "_Layout"); but this resulted in an error message about not finding the view. I wondered whether this is the underlying issue?? I note in another post it talked about name conflicts so I renamed the view and references to it to something more obscure than 'create'.

The only other thing I am doing which I didn't do on the standalone was to pass in data to the mailer so I could use dynamic data. This is causing problems with debugging as it raises an exception due to another process being already connected to it. Is there anything to write out to a log to assist?

Any ideas would be appreciated. If anymore details are needed then please shout.

Steve.

smsohan commented 12 years ago

Mailer needs to be in in the web project, the view finding breaks otherwise.


Sent from my iPhone S M Sohan

On 2012-02-25, at 6:11 AM, steve99 reply@reply.github.com wrote:

Hi,

I have got this working correctly in one project where I keep everything together. In the second I created a separate project which I scaffolded the mailers in and created a class which is called from my main controller. It does not raise any errors using PopulateBody(mailMessage, viewName: "CreateNbus"); and it generates an email however the body is empty (other dynamic data is fine). I am writing the email file to disk.

I tried dropping out the master line in the class per another post but this didn't work. I also tried PopulateHtmlBody(mailMessage, "CreateNbus", "_Layout"); but this resulted in an error message about not finding the view. I wondered whether this is the underlying issue?? I note in another post it talked about name conflicts so I renamed the view and references to it to something more obscure than 'create'.

The only other thing I am doing which I didn't do on the standalone was to pass in data to the mailer so I could use dynamic data. This is causing problems with debugging as it raises an exception due to another process being already connected to it. Is there anything to write out to a log to assist?

Any ideas would be appreciated. If anymore details are needed then please shout.

Steve.


Reply to this email directly or view it on GitHub: https://github.com/smsohan/MvcMailer/issues/41

steve99 commented 12 years ago

Ah that explains it then. Time to reverse for me. Cheers Steve.