Thanks for the reply Ricardo
The example you have still does not work for me. It crushes on
DeliverMail()
thanks
eyal
here is the stacktrace:
at Castle.MonoRail.Framework.Controller.DeliverEmail(Message
message) in c:\svn20\MonoRail\Castle.MonoRail.Framework
\Controller.cs:line 1466
at SN.Controllers.ContactController.sendEmail(String message,
String email, String name) in C:\SN3.0\SN\Controllers
\ContactController.cs:line 73
at SN.Controllers.ContactController.SendContact(Contact
contactFromPage) in C:\SN3.0\SN\Controllers\ContactController.cs:line
39
here is my exact code:
System.Collections.IDictionary parameters = new
System.Collections.Hashtable();
Castle.MonoRail.Framework.Internal.CommonUtils.MergeOptions
(parameters,
this.Helpers);
Castle.MonoRail.Framework.Internal.CommonUtils.MergeOptions
(parameters,
this.Flash);
Castle.MonoRail.Framework.Internal.CommonUtils.MergeOptions
(parameters,
this.PropertyBag);
Message msg = RenderMailMessage("/mail/contactus", "/
layouts/empty.vm", parameters);
//Message msg = RenderMailMessage("contactus", null,
PropertyBag);
msg.To = "[email protected]";
msg.From = email;
msg.Subject = "Contact Us Message";
DeliverEmail(msg);
RenderView("messagesent");
On Feb 24, 1:13 pm, Ricardo Lopes <[email protected]> wrote:
> Hi,
>
> As I said on one of my previous messages i was able to workaround the
> issue to fit my needs at the moment, but i didn't understood why did
> it change so much since the RC3 and i am waiting for more
> documentation on this.
>
> This are the changes i noticed:
>
> - i have to especify the absolute path to the view (the mail folder is
> not default as it was on RC3)
> - i have to especify the absolute path to the layout (the layout
> folder is not assumed, dont know how it was on RC3 because i didn't
> use layouts on mails, probably wasn't there because i dont remember
> them)
> - nothing is available as variables on the view engine (nvelocity in
> my case) unless i pass it as params, currently i'm passing the
> Helpers, Flash and PropertyBag, but Session and Context should be also
> there)
>
> Here is the code i'm using:
>
> System.Collections.IDictionary parameters = new
> System.Collections.Hashtable();
> Castle.MonoRail.Framework.Internal.CommonUtils.MergeOptions(parameters,
> this.Helpers);
> Castle.MonoRail.Framework.Internal.CommonUtils.MergeOptions(parameters,
> this.Flash);
> Castle.MonoRail.Framework.Internal.CommonUtils.MergeOptions(parameters,
> this.PropertyBag);
> RenderMailMessage("/mail/register", "/layouts/mail.vm", parameters);
>
> I think it should behave in the same way using this:
>
> RenderMailMessage("register", "mail.vm");
>
> But it doesn't, the default folders are not assumed and the default
> variables are not available.
>
> I think i should fill a bug, i will investigate a little bit more on
> this when i have the time.
>
> Thanks,
> Ricardo Lopes.
>
> 2009/2/24 eyal <[email protected]>:
>
>
>
>
>
> > 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 <[email protected]> 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 <[email protected]> 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 -
>
> --
>
> Ricardo Lopes
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---