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@example.com" from "firstname.lastname@example.org" 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.
on 2007-02-08 10:47
on 2007-02-08 12:31
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.
on 2007-02-08 12:48
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