Hi All,
I recently upgraded my app's trunk and encounter the same problem
using RenderMailMessage. I attempted to use the suggested solutions
but non worked.
I used this method:
Message msg = RenderMailMessage("contactus", null, PropertyBag);
msg.To = "
mysite.com";
msg.From = email;
msg.Subject = "Contact Us Message";
DeliverEmail(msg);
I keep on getting the following errors:
StackTrace:
at Castle.MonoRail.Framework.Controller.DeliverEmail(Message message)
in c:\svn20\MonoRail\Castle.MonoRail.Framework\Controller.cs:line 1466
at SpecialsNearby.Controllers.ContactController.sendEmail(String
message, String email, String name) in C:\SN3.0\SN\Controllers
\ContactController.cs:line 69
at SN.Controllers.ContactController.SendContact(Contact
contactFromPage) in C:\SN3.0\SN\Controllers\ContactController.cs:line
39
I also ued this method:
Hashtable emailDictionary = new Hashtable();
emailDictionary.Add("to", "
mysite.com");
emailDictionary.Add("from", email.Trim());
emailDictionary.Add("subject", "my subject");
emailDictionary.Add("message", "some message");
Message msg = RenderMailMessage("contactus", null,
emailDictionary);
DeliverEmail(msg);
Message: Object reference not set to an instance of an object.
StackTrack:
at
Castle.Components.Common.EmailSender.Smtp.SmtpSender.CreateMailMessage
(Message message) in c:\svn20\Components\EmailSender
\Castle.Components.Common.EmailSender\Smtp\SmtpSender.cs:line 175
at Castle.Components.Common.EmailSender.Smtp.SmtpSender.Send
(Message message) in c:\svn20\Components\EmailSender
\Castle.Components.Common.EmailSender\Smtp\SmtpSender.cs:line 149
at Castle.MonoRail.Framework.Services.MonoRailSmtpSender.Send
(Message message) in c:\svn20\MonoRail\Castle.MonoRail.Framework
\Services\MonoRailSmtpSender.cs:line 80
at Castle.MonoRail.Framework.Controller.DeliverEmail(Message
message) in c:\svn20\MonoRail\Castle.MonoRail.Framework
\Controller.cs:line 1457
Any suggestions? Did anyone resolve this problem?
Thanks
Eyal
On Feb 6, 5:05 am, Patrick Steele <
patrick.ste...@gmail.com> wrote:
> I just looked at some of my code using an early Dec/2008 version of
> MonoRail and my mail code is:
>
> System.Collections.Hashtable data = new System.Collections.Hashtable();
> data.Add("data1", data1);
> data.Add("data2", data2);
> Message msg =RenderMailMessage("reminder", null, data);
>
> The "reminder.vm" sits in my "Views\mail" folder.
>
> Hope this helps.
>
> --
> Patrick Steelehttp://
weblogs.asp.net/psteele
>
>
>
> On Fri, Feb 6, 2009 at 5:02 AM, Ricardo Lopes <
rjlo...@gmail.com> wrote:
> > I was only able to "almost" make it work as I wanted using complete path for
> > the view, complete path including extension for the layout and passing the
> > PropertyBag as parameters param. In my case is like this:
> >RenderMailMessage("/mail/register", "/layouts/mail.vm", PropertyBag);
> > And I think something like this would be more appropriate:
> >RenderMailMessage("register", "mail");
> > I don't understand why is it so different from the RC3 and from the
> > controller/view mechanism. If I am in a controller and i call RenderView I
> > don't have to include the view folder because is assumed that is the
> > controler name, and nowhere else I include the view extension, and the
> > PropertyBag and Helpers where automaticaly available.
> > Why is this behaviour so different?
> > How can i make the Helpers available to the view engine?- Hide quoted text -
>
> - Show quoted text -