this is how i configured EmailSender: <monorail smtpHost="smtp.hostname.com" smtpUsername="[email protected]" smtpPassword="mypass" useWindsorIntegration="false"> <controllers> <assembly>SN</assembly> </controllers> <viewEngines viewPathRoot="Views"> <add xhtml="false" type="Castle.MonoRail.Framework.Views.NVelocity.NVelocityViewEngine, Castle.MonoRail.Framework.Views.NVelocity" /> </viewEngines>
</monorail> I also added this ref lib: Castle.Components.Common.EmailSender Ver: 1.0.3.0 Runtime Ver: v2.0.50727 In addition this is the exception that is generated on the actual website: Castle.MonoRail.Framework.MonoRailException: Error sending e-mail ---> System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 216.10.246.151:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send (MailMessage message) at Castle.Components.Common.EmailSender.Smtp.SmtpSender.Send(Message message) at Castle.MonoRail.Framework.Services.MonoRailSmtpSender.Send (Message message) at Castle.MonoRail.Framework.Controller.DeliverEmail (Message message) --- End of inner exception stack trace --- at Castle.MonoRail.Framework.Controller.DeliverEmail(Message message) at SN.Controllers.ContactController.sendEmail(String message, String email, String name) at SN.Controllers.ContactController.SendContact (Contact contactFromPage) On Feb 25, 1:27 am, Ricardo Lopes <[email protected]> wrote: > If the problem is on DeliverMail then is not the same problem. > Did you configure the EmailSender correctly ? > > 2009/2/25 eyal <[email protected]> > > > > > > > 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 > > -- > > 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 -~----------~----~----~----~------~----~------~--~---
