I'm sorry if I'm newbish on this subject and some things I understand 
and others I don't.  I believe I have this very close to being correct:

My Mailer modle is mailer.rb

class Mailer < ActionMailer::Base

  def notifications(email_params, sent_at = Time.now)
    subject    email_params[:subject]
    recipients '[email protected]'
    from       email_params[:address]
    sent_on    sent_at
    body       :greeting => email_params[:body], :sender_name => 
email_params[:name]
  end

end

As you can see it has the class Mailer which is a part of 
ActionMailer::Base.  I'm also defining the method for notifications and 
asking for email_params to be sent to it.

The controller for my contacts page:

  def send_mail
    Mailer.deliver_notifications(params[:email])
    flash[:notice] = "Email was succesfully sent."
    redirect_to :action => "index"
  end

Contains the method for send_mail which is making a direct call to the 
Mailer class and providing params[:email].

params[:email] parameters are specified from the view:

                    <% 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 %>

Again, I get no errors of any sort but no mail is received.  If you see 
something that I'm doing wrong, if you could provide a small code 
snippet for correction, I will understand your explanation better.
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to