Hi,

I am new to ROR and i trying to send emails using rails version 2.0.2.
But the recipients did not receive the mail i check the log file also

parameters: {"commit"=>"Send Email",
"authenticity_token"=>"184d6f1d9095962085dcd800ce0581bda32f04ae",
"action"=>"send_mail", "controller"=>"emailer", "email"=>{"name"=>"xxx",
"body"=>"Test Mail sending using Rails ", "subject"=>"TestMail",
"address"=>"[EMAIL PROTECTED]"}}
Sent mail:
 Date: Thu, 20 Nov 2008 15:07:21 +0530

From: [EMAIL PROTECTED]

To: [EMAIL PROTECTED]

Subject: TestMail

Mime-Version: 1.0

Content-Type: text/html; charset=utf-8



Name:

xxx

Message:

Test Mail sending using Rails
Redirected to http://localhost:3001/emailer
Completed in 0.04700 (21 reqs/sec) | DB: 0.00000 (0%) | 302 Found
[http://localhost/emailer/send_mail]

(*) And My Configuration as
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
   :address => "ip",
   :port => 26,
   :user_name => "[EMAIL PROTECTED]",
   :password => "rrr",
}
ActionMailer::Base.default_content_type = "text/html"
#ActionMailer::Base.raise_delivery_errors = true

(*) In my model is
class Emailer < ActionMailer::Base
  def contact_email(email_params, sent_at = Time.now)
        @recipients = email_params[:address]
        @from = "[EMAIL PROTECTED]"
        @subject = email_params[:subject]
        @sent_on = sent_at
        @body["email_body"] = email_params[:body]
        @body["email_name"] = email_params[:name]
    end
end

(*) Controller
class EmailerController < ApplicationController
def send_mail
      Emailer.deliver_contact_email(params[:email])
      redirect_to :action => 'index'
end
def index
      render :file => 'app\views\emailer\index.html.erb'
end
end

(*) And view is "index.rhtml"
<% form_tag :action=>'send_mail' do %>
<table>
    <tr>
        <td><label for="email_name">Name:</label></td>
        <td><%= text_field "email", "name", :size => 30 %></td>
    </tr>
    <tr>
        <td><label for="email_address">Email Address:</label></td>
        <td><%= text_field "email", "address", :size => 30 %></td>
    </tr>
    <tr>
        <td><label for="email_subject">Subject:</label></td>
        <td><%= text_field "email", "subject", :size => 30 %></td>
    </tr>
    <tr>
        <td><label for="email_body">Body:</label></td>
        <td><%= text_area "email", "body", :rows => 8, :cols => 30 %></
<td>
</tr>
</table>
<%= submit_tag 'Send Email' %>
<% end -%>

(*)And one more rhtml is "contact_email.rhtml"
Name:
<%= @email_name %>
Message:
<%= @email_body %>

If any one knows Please let me know. Thanks in Advance.

Regards
Devi.R
-- 
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