# Actionmailer cant sent the mail

**URL:** <https://www.ruby-forum.com/t/actionmailer-cant-sent-the-mail/135036>\
**Category:** Rails\
**Created:** [April 17, 2008, 11:55am UTC](https://www.ruby-forum.com/t/actionmailer-cant-sent-the-mail/135036 "2008-04-17T11:55:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prionko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@prionko](https://www.ruby-forum.com/u/prionko)\
**Post date:** [April 17, 2008, 11:55am UTC](https://www.ruby-forum.com/t/actionmailer-cant-sent-the-mail/135036/1 "2008-04-17T11:55:26Z")

</div>

Hi everybody,  
Im facing problems in sending mail using actionmailer. Im trying to do a  
simple stuff where user types in his message and the receiptent email  
address, the n that message should be received by the receiptent. I have  
checked the development.log file, but there I havent noticed any error,  
the workflow of the program is fine, but at the end of the day, the  
receiptent is not receiving the mail

Below is the controller file:

class EmailerController \< ApplicationController  
def sendmail  
recipient = params[:reciptent]  
subject = params[:subject]  
message = params[:message]  
Emailer.deliver\_contact(recipient, subject, message)  
return if request.xhr?  
render :text =\> ‘Message sent successfully’  
end

thiis is the emailer class:

class Emailer \< ActionMailer::Base  
def contact(recipient, subject, message, sent\_at = Time.now)  
@subject = subject  
@recipients = recipient  
@from = ‘[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)’  
@sent\_on = sent\_at  
body[“title”] = ‘This is title’  
body[“email”] = ‘removed\_email\_address@domain.invalid’  
body[“message”] = message  
@content\_type = “text/html”

```
  @headers['Reply-To'] = "'Webmaster' <removed_email_address@domain.invalid>"

```

end  
end

This the settings that I have put in environment.rb file

ActionMailer::Base.raise\_delivery\_errors = true;  
ActionMailer::Base.delivery\_method = :smtp;

ActionMailer::Base.smtp\_settings = {  
:address =\> “[smtp.bizmail.yahoo.com](http://smtp.bizmail.yahoo.com)”,  
:port =\> 25,  
:domain =\> “[bizmail.yahoo.com](http://bizmail.yahoo.com)”,  
:authentication =\> :plain,  
:user\_name =\> “removed\_email\_address@domain.invalid”,  
:password =\> “somepassword”  
}

and this is the setting is development.rb file

config.action\_mailer.raise\_delivery\_errors = true  
config.action\_mailer.delivery\_method = :smtp

this is output is my development log file

Processing EmailerController#sendmail (for 127.0.0.1 at 2008-04-16  
17:11:41) [POST]  
Session ID:  
BAh7BzoMY3NyZl9pZCIlZjZiYjY5NmMzZTM1YzUzZTRjMDY4ZWQ4MjU2NzJi%0ANWQiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh%0Ac2h7AAY6CkB1c2VkewA%3D–ff14f980e27ff9a4a3edfb58c9afd2b1375d0587  
Parameters: {“commit”=\>“Send”,  
“authenticity\_token”=\>“7c49f8693944b6af67e8ed12b38de4b6fa7db513”,  
“action”=\>“sendmail”, “controller”=\>“emailer”,  
“email”=\>{“message”=\>“klfdglkdfj”, “recipient”=\>“[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)”,  
“subject”=\>“HIiii”}}  
Sent mail:  
Date: Wed, 16 Apr 2008 17:11:41 +0530

From: removed\_email\_address@domain.invalid

Reply-To: ‘Saurav’ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Subject: Hi

Mime-Version: 1.0

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

Hi!

You are having one email message from removed\_email\_address@domain.invalid with a  
tilte

This is title  
and following is the message:

Thanks  
Completed in 3.75000 (0 reqs/sec) | Rendering: 0.00000 (0%) | DB:  
0.00000 (0%) | 200 OK [[http://localhost/emailer/sendmail](http://localhost/emailer/sendmail)]

* * *

Please guys help me out …

Thanks  
-Saurav

---

<div class="post-metadata">

**Author:** ![prionko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@prionko](https://www.ruby-forum.com/u/prionko)\
**Post date:** [April 17, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/actionmailer-cant-sent-the-mail/135036/2 "2008-04-17T12:15:29Z")

</div>

On 17 Apr 2008, at 10:55, Saurav C. wrote:

> receiptent is not receiving the mail
> 
> Below is the controller file:
> 
> class EmailerController \< ApplicationController  
> def sendmail  
> recipient = params[:reciptent]

You’ve got a typo, and so you’re not setting the recipient (notice in  
the log how it doesn’t say who the email is sent to )

Fred

---

<div class="post-metadata">

**Author:** ![prionko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@prionko](https://www.ruby-forum.com/u/prionko)\
**Post date:** [April 17, 2008, 1:14pm UTC](https://www.ruby-forum.com/t/actionmailer-cant-sent-the-mail/135036/3 "2008-04-17T13:14:53Z")

</div>

Thanx a lot for the help…I dont know how I missed that

Frederick C. wrote:

> On 17 Apr 2008, at 10:55, Saurav C. wrote:
> 
> > receiptent is not receiving the mail
> > 
> > Below is the controller file:
> > 
> > class EmailerController \< ApplicationController  
> > def sendmail  
> > recipient = params[:reciptent]
> 
> You’ve got a typo, and so you’re not setting the recipient (notice in  
> the log how it doesn’t say who the email is sent to )
> 
> Fred
