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
<optionvalue=“Excellent”>Excellent
4. VeryGood
5. Fair
6. Poor
7. VeryPoor
8.
<optionvalue=“Excellent”>Excellent
11. VeryGood
12. Fair
13. Poor
14. VeryPoor
15.
here is the action feedback in the controller mailer
- def feedback
-
if request.post?
-
begin
-
Notifier.deliver_feedback(params[:feedback])
-
flash[:message] = "Feedback sent"
-
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
- def feedback(feedback)
-
@recipients = '[email protected]'
-
@from = feedback[:email]
-
@subject = 'Feedback for website'
-
@body['content'] = feedback[:content]
-
@body['design'] = feedback[:design]
- end
i created a rhtml file named feedback in views/notifier
the content to be sent in the email
- Dear Administrator,
- You have got a feedback for the website
- Scores
- Content : <%= @content %>
- Design : <%= @design %>
- Usability : <%= @usability %>
- 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
-
Skip frameworks you’re not going to use (only works if using
vendor/rails)
-
config.frameworks -= [ :action_web_service]
-
Include your app’s configuration here:
-
ActionMailer::Base.server_settings = {
-
:address => “abc”,
-
:port => 25,
-
:domain => ‘abc’,
-
:user_name => “[email protected]”,
-
:password => “mypass”,
-
:authentication => :login
-
}
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.