Has anyone used ActionMailer outside of rails? I have a requirement for work that will not allow me to do this from within a rails app. I have successfully sent an email in the following manner: MyMailer.deliver_clever_email(someArg,''testing!'') where the second argument is the body of the email, but when I try to call just: MyMailer.deliver_clever_email(someAr) and use a template, it complains that it doesn''t know where to find the rhtml template. How do I tell it where to look? Any help would be greatly appreciated! -jay -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ActionMailer has a configuration option called template_root. http://api.rubyonrails.org/classes/ActionMailer/Base.html (see Configuration) This allows you to set the search path for templates. AFAIK, this is really just the root, so it will look for ''#{TEMPLATE_ROOT}/my_mailer/clever_email.rhtml''. Jason Guiditta wrote:> Has anyone used ActionMailer outside of rails? I have a requirement for > work that will not allow me to do this from within a rails app. I have > successfully sent an email in the following manner: > > MyMailer.deliver_clever_email(someArg,''testing!'') > > where the second argument is the body of the email, but when I try to > call just: > > MyMailer.deliver_clever_email(someAr) > > and use a template, it complains that it doesn''t know where to find the > rhtml template. How do I tell it where to look? Any help would be > greatly appreciated! > > -jay-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Many thanks, Florian, that was exactly what I missed, works like a charm now! All I had to to was point it to the root view directory and it figured the rest out on its own :) ActionMailer::Base.template_root = "views/" -jay Florian Gilcher wrote:> ActionMailer has a configuration option called template_root. > > http://api.rubyonrails.org/classes/ActionMailer/Base.html (see > Configuration) > > This allows you to set the search path for templates. AFAIK, this is > really just the root, so it will look for > ''#{TEMPLATE_ROOT}/my_mailer/clever_email.rhtml''.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---