Forum: Ruby on Rails ActionMailer Question -- can't find email templates

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7252adadcb6c9e824375c8deaf7174ae?d=identicon&s=25 Nola Stowe (Guest)
on 2006-03-09 02:46
(Received via mailing list)
I have a PageController that displays a form. The form is just
straight HTML, I only used the form helpers for the form tag as so:

--
<%= form_tag({:action => :send_request}, {:method=>:post,
:name=>'childsplay'})%>
--


In my page controller I have this:

--
def send_request
    email = InfoMailer::deliver_sendrequest(params)
end
---

in my action mailer class I have this:
controllers/info_mailer.rb

---
class InfoMailer < ActionMailer::Base
  def sendrequest(formparms)
    sent_at = Time.now
    @to         = 'info@illinoisatplay.com'
    @cc         = 'nola@devasap.com'
    @subject    = 'Thank you for your request'
    @recipients = ''
    @from       = 'webserver@illinoisatplay.com'
    @sent_on    = sent_at
    @headers    = {}

    @body['name'] = formparms[:from_name]
  end
end
---

The error I get is this:


ActionView::ActionViewError in Page#send_request

No rhtml, rxml, or delegate template found for sendrequest.rhtml


I REALLY DO have a a rhtml file at views/info_mailer/sendrequest.rhtml

it contains the following:

---
Dear <%=@from_name %>,

Thank you for your request, we will respond shortly!
---


Any ideas? .. when I assign a body the message I want to send:

  def sendrequest(formparms)
    sent_at = Time.now
    @to         = 'info@illinoisatplay.com'
    @cc         = 'nola@devasap.com'
    @subject    = 'Thank you for your request'

    @recipients = ''
    @from       = 'webserver@illinoisatplay.com'
    @sent_on    = sent_at
    @headers    = {}

   #@body       = 'Thank you, the request is being processed'
  end
---

That works ok, it just doesn't seem to be finding the template. What
am I doing wrong??



--
http://PhpGirl.blogger.com
http://CodeSnipers.com
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2006-03-10 06:09
(Received via mailing list)
Nola Stowe wrote:

> ...
> --
> def send_request
>     email = InfoMailer::deliver_sendrequest(params)
> end
> ---
>
> in my action mailer class I have this:
> controllers/info_mailer.rb
> ...

Mailers are usually put in the models directory, and
their deliver methods are usually called as class methods
using the dot notation, rather than with the :: notation.

--
We develop, watch us RoR, in numbers too big to ignore.
This topic is locked and can not be replied to.