No rhtml, rxml, rjs or delegate template found for sent

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 “[email protected]
from “[email protected]
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


<%= start_form_tag(:name => ‘myFrm’, :action => ‘sendmail’)%>
<%= submit_tag “Send Mail”%>
<%= end_form_tag%>

Please help me somebody.

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.

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs