Forum: Ruby on Rails problem with my feedback form

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.
Vinod jeffrey C. (Guest)
on 2007-02-18 11:52
ive been breaking my head to send an email from the feedback form in my
website. Ive followed a few tutorials on rails forum and else where but
i cant get it to work yet. So i want to know where i have been going
wrong.

Here is my code in the view which gets the values for the feedback


   1. <form name="feedback" method="POST" action="/mailer/feedback">

   2.  <select name= "feedback[content]">
   3.
<optionvalue="Excellent">Excellent</option>
   4.                             <option value="Very
Good">VeryGood</option>
   5.                             <option vlaue="Fair">Fair</option>
   6.                             <option value="Poor">Poor</option>
   7.                             <option value="Very
Poor">VeryPoor</option>
   8.  </select>

   9.  <select name= "feedback[design]">
  10.
<optionvalue="Excellent">Excellent</option>
  11.                             <option
value="VeryGood">VeryGood</option>
  12.                             <option vlaue="Fair">Fair</option>
  13.                             <option value="Poor">Poor</option>
  14.                             <option
value="VeryPoor">VeryPoor</option>
  15.  </select>


here is the action feedback in the controller mailer

   1. def feedback
   2.         if request.post?
   3.             begin
   4.                Notifier.deliver_feedback(params[:feedback])
   5.                flash[:message] = "Feedback sent"
   6.               redirect_to :controller => '/site', :action =>
'home'
   7.             rescue
   8.               flash[:message] = "Error Sending mail"
   9.               redirect_to :controller => '/site', :action =>
'home'
  10.             end
  11.         end
  12. end

i also created a mailer named Notifier and the contents of the notifier
is as follows

   1. def feedback(feedback)
   2.
   3.       @recipients                         = 
'removed_email_address@domain.invalid'
   4.       @from                               = feedback[:email]
   5.       @subject                            = 'Feedback for website'
   6.       @body['content']                    = feedback[:content]
   7.       @body['design']                     = feedback[:design]
   8. end

i created a rhtml file named feedback in views/notifier
the content to be sent in the email

   1. Dear Administrator,
   2.
   3. You have got a feedback for the website
   4.
   5. Scores
   6.
   7. Content        : <%= @content %>
   8. Design         : <%= @design %>
   9. Usability      : <%= @usability %>
  10.
  11. Comments       : <%= @comments %>


i added these in environment.rb file as follows

i actually removed the word :action_mailer from config.frameworks as
described in a wiki tutorial

  1. # Skip frameworks you're not going to use (only works if using
vendor/rails)

   2.   # config.frameworks -= [ :action_web_service]
   3.
   4.   # Include your app's configuration here:

   5. ActionMailer::Base.server_settings = {
   6.   :address  => "abc",
   7.   :port  => 25,
   8.   :domain  => 'abc',
   9.   :user_name  => "removed_email_address@domain.invalid",
  10.   :password  => "mypass",
  11.   :authentication  => :login
  12.     }
I want to know where i have been going wrong or anything i missed thats
stopping from sending email. Its been 2 days ive been working on this
without any luck. Any help is very much appreciated

sorry for double posting i had to clean the post and i didnt know a way
to edit my post.
This topic is locked and can not be replied to.