# Trying to get ActionMailer set up for the first time

**URL:** <https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784>\
**Category:** Rails\
**Created:** [February 11, 2008, 3:14pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784 "2008-02-11T15:14:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [February 11, 2008, 3:14pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/1 "2008-02-11T15:14:21Z")

</div>

I’ve got “config.action\_mailer.delivery\_method = :smtp” in my  
environment.rb file AND it’s beneath the Rails:: Initializer.run do  
|config| line.

At the bottom of the environment.rb file I have:  
ActionMailer::Base.delivery\_method = :smtp  
ActionMailer::Base.smtp\_settings = {  
:address =\> “[servername.domain.com](http://servername.domain.com)”,  
:port =\> 25,  
:domain =\> “[domain.com](http://domain.com)”,  
:authentication =\> :login,  
:user\_name =\> “login”,  
:password =\> “password”

My order\_mailer Controller:  
def mail  
from “removed\_email\_address@domain.invalid”  
recipients “removed\_email\_address@domain.invalid”  
subject “New order to review”  
end

My order\_mailer/mail View:  
Hi,  
A new order has been entered. Please review it.

After adding a new order in the order Controller, I have this line near  
the bottom of the Create action:  
OrderMailer.deliver\_mail

After adding an order, the logs reads:  
  
Sent mail:  
Mime-Version: 1.0  
Content-Type: text/plain; charset=utf-8  
Hi,  
A new order has been entered. Please review it.

But I never receive the email.

In addition to trying to send email to my business account, I tried  
sending to my personal account and to a gmail account. Still no email.  
Just for the heck of it, I tried changing the password, and I got a 501  
authenication error. So, I can safely say that it’s definitely getting  
to the smtp server. I’m not sure how else to troubleshoot this. Any  
suggestions?

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [February 11, 2008, 5:02pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/2 "2008-02-11T17:02:52Z")

</div>

Hi,

Try adding these to your environment.rb

ActionMailer::Base.perform\_deliveries = true  
ActionMailer::Base.raise\_delivery\_errors = true  
ActionMailer::Base.default\_charset = “utf-8”

Also check the port for your mail settings.

Neha

On Feb 11, 9:14 am, Denise R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [February 11, 2008, 5:50pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/3 "2008-02-11T17:50:28Z")

</div>

I added those and tried tweaking this and that (again!), but nothing is  
different. I still see the email in the log, but it never arrives in an  
inbox. Any other thoughts?

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [February 11, 2008, 8:44pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/4 "2008-02-11T20:44:40Z")

</div>

Denise,  
I didn’t go through your entire post, but this may be of help →

> **[\#61 Sending Email - RailsCasts](http://railscasts.com/episodes/61-sending-email)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

On Feb 11, 11:50 am, Denise R. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [February 11, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/5 "2008-02-11T23:15:00Z")

</div>

Are you sure your port number is correct. If you are using gmail, then  
the port should be 587.  
Check for the port number.

Else try to get the mail on a different domain name like gmail and  
all.

On Feb 11, 11:50 am, Denise R. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [February 12, 2008, 2:37pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/6 "2008-02-12T14:37:58Z")

</div>

ebrad wrote:

> This may be of help → [#61 Sending Email - RailsCasts](http://railscasts.com/episodes/61)

Thanks. I love RailsCasts. I’ll check that out.

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [March 6, 2008, 12:31am UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/7 "2008-03-06T00:31:29Z")

</div>

you might want to look at this link about gmail specifically and  
ActionMailer, since it sounds like your using gmail.

[http://www.prestonlee.com/archives/63](http://www.prestonlee.com/archives/63)

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [February 12, 2008, 2:37pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/8 "2008-02-12T14:37:18Z")

</div>

Neha C. wrote:

> If you are using gmail, then the port should be 587.

Thanks. I didn’t realize that. I know that port is correct for my  
personal account, but I didn’t change it for the google account.

---

<div class="post-metadata">

**Author:** ![gorgeoussoul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6f9a4e/32.png) [@gorgeoussoul](https://www.ruby-forum.com/u/gorgeoussoul)\
**Post date:** [March 6, 2008, 2:13pm UTC](https://www.ruby-forum.com/t/trying-to-get-actionmailer-set-up-for-the-first-time/128784/9 "2008-03-06T14:13:02Z")

</div>

Thanks for the advice, everyone.

I ended up deleting everything and then recreating it. And it worked  
perfectly.
