>
>
>  def notifications(sent_at = Time.now)
>    subject    params[:subject]

You're not in your controller anymore - you can't access the params  
hash like that. Anything you need in your mailer needs to be passed as  
an argument to it (although you could pass params hash itself if you  
wanted)

Fred
>    recipients 'webmas...@ncaastatpages.com'
>    from       params[:address]
>    sent_on    sent_at
>    body       :greeting => params[:body], :sender_name => params 
> [:name]
>  end
>
> ==========================================
>
> I created the contact controller which contains:
>
> class ContactController < ApplicationController
>  def index
>    # render index.html.erb
>  end
>
>  def send_mail
>    Mailer.deliver_notifications(params[:email])
>    flash[:notice] = "Email was succesfully sent."
>    redirect_to :action => "index"
>  end
> end
>
> ===========================================
>
> I have the form in my contact view for index.html.erb
>
> <td>
>                    <% form_tag :action => "send_mail" do %>
>                      <tr><td>
>                          <%= label :email, :name, "Name" %><br />
>                          <%= text_field :email, :name %>
>                      </td></tr>
>                      <tr><td>
>                          <%= label :email, :address, "Your Email
> Address" %><br />
>                          <%= text_field :email, :address %>
>                      </td></tr>
>                      <tr><td>
>                          <%= label :email, :subject, "Subject"  
> %><br />
>                          <%= text_field :email, :subject %>
>                      </td></tr>
>                      <tr><td>
>                          <%= label :email, :body, "Your Message" %><br
> />
>                          <%= text_area :email, :body, :rows =>  
> 8, :cols
> => 50 %>
>                      </td></tr>
>                      <tr><td>
>                          <%= submit_tag "Submit" %>
>                      </td></tr>
>                    <% end %>
>                  </td>
>
> ==================================================
>
> I added the following map route:
>
> map.contact '/contact/send_mail', :controller => 'contact', :action =>
> 'send_mail'
>
> ==================================================
>
> I go to the contacts page and see the form fine.
>
> When I enter the information and submit I receive the following error:
>
> undefined local variable or method `params' for #<Mailer:0x3c9d6f8>
>
> It shows contact_controller.rb:7:in `send_mail'
>
> which contains..
>
> Mailer.deliver_notifications(params[:email])
>
> ==================================================
>
> I know I'm probably doing a few things wrong but mailing seems to be a
> very difficult process for me to learn.  Any help would be  
> appreciated.
>
> Thanks.
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to