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"=>"sss.k-Ucrn+fOwHfY@public.gmane.org"}}
Sent mail:
Date: Thu, 20 Nov 2008 15:07:21 +0530
From: xxx-Ucrn+fOwHfY@public.gmane.org
To: sss.k-Ucrn+fOwHfY@public.gmane.org
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 => "rrr-Ucrn+fOwHfY@public.gmane.org",
: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 = "xxx-Ucrn+fOwHfY@public.gmane.org"
@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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Jeff Pritchard
2008-Nov-21 03:00 UTC
Re: Recipients did not receive the mail in Rails 2.0.2
Devi,
What do the smtp settings in your config/environments/production.rb file
look like? Or if you are sending from your development machine, look at
development.rb.
Mine looks like this:
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "localhost",
:port => 25,
:domain => "yourdomain.com",
}
HTH,
jp
Devi Rv wrote:> 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
>
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---