Forum: Ruby on Rails No rhtml, rxml, rjs or delegate template found for sent

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.
784e13ffb781304767843b78044c70b8?d=identicon&s=25 abhishek (Guest)
on 2007-02-08 10:47
i m trying to send e-mail.
i have generated model, controller & view file for it.
but its giving me error like "No rhtml, rxml, rjs or delegate template
found for sent"

model:
       class MyMailer < ActionMailer::Base
  def sent(msg)
    subject "Hello"
    recipients "hiral29_desai29@yahoo.com"
    from "abhi.janu83@gmail.com"
    sent_on Time.now
    content_type "text/html"
    body "msg"=> msg
  end
end

controller:
    def sendmail
    msg="hi from abhi..."
    email=MyMailer.create_sent(msg)
    MyMailer.deliver(email)
    render :text=>"Mail has been sent...!"
  end

view:
     hello.rhtml
      <html>
    <body>
        <%= start_form_tag(:name => 'myFrm', :action => 'sendmail')%>
            <%= submit_tag "Send Mail"%>
        <%= end_form_tag%>
    </body>
</html>

Please help me somebody.
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (au5lander)
on 2007-02-08 12:31
(Received via mailing list)
http://api.rubyonrails.org/classes/ActionMailer/Base.html

read the section titled 'Mailer Views'

in a nutshell, rails is looking for apps/views/mymailer/sent.rhtml and
can't find it.
67f61f0c385168c4b2e5b8fd733c397f?d=identicon&s=25 Christos Zisopoulos (Guest)
on 2007-02-08 12:48
(Received via mailing list)
Abhishek,

You need to have an RHTML template for each action of your
ActionMailer model. So in your case, you will need:

  app/views/mymailer/sent.rhtml

What you put in this template is the HTML (in your case) that will be
sent to the user. You have access to the variables you defined in
your sent action, just like any in other view.

Have a look here...

   http://f8p.com/6z1smm


...and here...

   http://f8p.com/c0vvgh

-christos
This topic is locked and can not be replied to.