# Recipients did not receive the mail in Rails 2.0.2

**URL:** <https://www.ruby-forum.com/t/recipients-did-not-receive-the-mail-in-rails-2-0-2/153704>\
**Category:** Rails\
**Created:** [November 20, 2008, 10:57am UTC](https://www.ruby-forum.com/t/recipients-did-not-receive-the-mail-in-rails-2-0-2/153704 "2008-11-20T10:57:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![devirv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@devirv](https://www.ruby-forum.com/u/devirv)\
**Post date:** [November 20, 2008, 10:57am UTC](https://www.ruby-forum.com/t/recipients-did-not-receive-the-mail-in-rails-2-0-2/153704/1 "2008-11-20T10:57:03Z")

</div>

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”=\>“removed\_email\_address@domain.invalid”}}  
Sent mail:  
Date: Thu, 20 Nov 2008 15:07:21 +0530

From: removed\_email\_address@domain.invalid

To: removed\_email\_address@domain.invalid

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](http://localhost:3001/emailer)  
Completed in 0.04700 (21 reqs/sec) | DB: 0.00000 (0%) | 302 Found  
[[http://localhost/emailer/send\_mail](http://localhost/emailer/send_mail)]

(\*) And My Configuration as  
ActionMailer::Base.delivery\_method = :smtp  
ActionMailer::Base.smtp\_settings = {  
:address =\> “ip”,  
:port =\> 26,  
:user\_name =\> “removed\_email\_address@domain.invalid”,  
: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 = “removed\_email\_address@domain.invalid”  
@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 %\>

| Name: | \<%= text\_field "email", "name", :size =\> 30 %\> |
| Email Address: | \<%= text\_field "email", "address", :size =\> 30 %\> |
| Subject: | \<%= text\_field "email", "subject", :size =\> 30 %\> |
| Body: | \<%= text\_area "email", "body", :rows =\> 8, :cols =\> 30 %\>\</ | |

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

---

<div class="post-metadata">

**Author:** ![devirv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@devirv](https://www.ruby-forum.com/u/devirv)\
**Post date:** [November 21, 2008, 4:00am UTC](https://www.ruby-forum.com/t/recipients-did-not-receive-the-mail-in-rails-2-0-2/153704/2 "2008-11-21T04:00:28Z")

</div>

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](http://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
