# Action\_mailer\_tls + Gmail

**URL:** <https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674>\
**Category:** Rails\
**Created:** [April 24, 2008, 4:32am UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674 "2008-04-24T04:32:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [April 24, 2008, 4:32am UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674/1 "2008-04-24T04:32:11Z")

</div>

Hi, i am really struggling with getting gmail working in my rails  
app.

I have installed this plugin:

[https://openrain.com/opensource/public/rails/plugins/action\_mailer\_tls/](https://openrain.com/opensource/public/rails/plugins/action_mailer_tls/)

I am implementing the ‘forgot password’ feature in  
restful\_authentication.

Anyway, in my development log it appears that the email is sent, as i  
see the following:

Sent mail:  
Date: Thu, 24 Apr 2008 12:20:01 +1000  
From: removed\_email\_address@domain.invalid  
To: removed\_email\_address@domain.invalid  
Subject: Mydomain - You have requested to change your password  
Mime-Version: 1.0  
Content-Type: text/plain; charset=utf-8

However , i subsequently get this “timeout” error:

Timeout::Error (execution expired):  
/opt/local/lib/ruby/1.8/timeout.rb:54:in `open' /vendor/plugins/action_mailer_tls/lib/smtp_tls.rb:10:in `do\_start’  
/opt/local/lib/ruby/1.8/timeout.rb:56:in `timeout' /opt/local/lib/ruby/1.8/timeout.rb:76:in `timeout’  
/vendor/plugins/action\_mailer\_tls/lib/smtp\_tls.rb:10:in `do_start' /opt/local/lib/ruby/1.8/net/smtp.rb:378:in `start’  
/opt/local/lib/ruby/1.8/net/smtp.rb:316:in `start' /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/ action_mailer/base.rb:586:in `perform\_delivery\_smtp’  
/opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/  
action\_mailer/base.rb:469:in ` __send__' /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/ action_mailer/base.rb:469:in `deliver!’  
/opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/  
action\_mailer/base.rb:352:in `method_missing' /app/models/user_observer.rb:8:in `after\_save’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/observer.rb:157:in `send' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/observer.rb:157:in `update’  
/opt/local/lib/ruby/1.8/observer.rb:185:in `notify_observers' /opt/local/lib/ruby/1.8/observer.rb:184:in `each’  
/opt/local/lib/ruby/1.8/observer.rb:184:in `notify_observers' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/callbacks.rb:338:in `notify’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/callbacks.rb:302:in `callback' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/callbacks.rb:214:in `create\_or\_update’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/base.rb:1972:in `save_without_validation' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/validations.rb:934:in `save\_without\_transactions’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/transactions.rb:108:in `save_without_captcha' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/connection_adapters/abstract/database_statements.rb: 66:in `transaction’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/transactions.rb:80:in `transaction' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/transactions.rb:100:in `transaction’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/transactions.rb:108:in `save_without_captcha' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/transactions.rb:120:in `rollback\_active\_record\_state!’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/transactions.rb:108:in `save_without_captcha' /vendor/plugins/simple_captcha/lib/simple_captcha_active_record.rb: 84:in `save’  
/app/controllers/passwords\_controller.rb:15:in `create' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1158:in `send’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/base.rb:1158:in `perform_action_without_filters' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:697:in `call\_filters’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/filters.rb:689:in `perform_action_without_benchmark' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:68:in `perform\_action\_without\_rescue’  
/opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:68:in `perform\_action\_without\_rescue’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/rescue.rb:199:in `perform_action_without_caching' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/caching.rb:678:in `perform\_action’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/connection\_adapters/abstract/query\_cache.rb:33:in  
`cache' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/query_cache.rb:8:in `cache’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/caching.rb:677:in `perform_action' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:524:in `send’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/base.rb:524:in `process_without_filters' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:685:in `process\_without\_session\_management\_support’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/session\_management.rb:123:in `process' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:388:in `process’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/dispatcher.rb:171:in `handle_request' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:115:in `dispatch’  
/opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/dispatcher.rb:126:in `dispatch_cgi' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:9:in `dispatch’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/  
rails.rb:76:in `process' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/ rails.rb:74:in `synchronize’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/  
rails.rb:74:in `process' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 159:in `process\_client’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
158:in `each' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 158:in `process\_client’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
285:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 285:in `initialize’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
285:in `new' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 285:in `run’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
268:in `initialize' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 268:in `new’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
268:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ configurator.rb:282:in `run’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
configurator.rb:281:in `each' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ configurator.rb:281:in `run’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel\_rails:  
128:in `run' /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ command.rb:212:in `run’  
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel\_rails:  
281  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/  
active\_support/dependencies.rb:489:in `load' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/dependencies.rb:489:in `load’  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/  
active\_support/dependencies.rb:342:in `new_constants_in' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/dependencies.rb:489:in `load’  
/opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/  
mongrel.rb:64  
/opt/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/  
active\_support/dependencies.rb:496:in `require' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/dependencies.rb:342:in `new\_constants\_in’  
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/  
active\_support/dependencies.rb:496:in `require' /opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/ server.rb:39 /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem\_original\_require’  
/opt/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require' ./script/server:3 -e:2:in `load’  
-e:2

Does anyone know what could be happening?? The email does not actually  
get sent when i check my hotmail account…

Many thanks,

PJ.

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [April 24, 2008, 5:18am UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674/2 "2008-04-24T05:18:16Z")

</div>

Hallo Praveen Jayarajan:

What your email is delivered to your user or tested email?

Try this modify it to your environtment.rb:  
ActionMailer::Base.raise\_delivery\_errors = false

or you can read it :

> **[Action Mailer with Gmail or Another Email Account](http://teapoci.blogspot.com/2008/04/action-mailer-with-gmail-or-another.html)**
>
> \[1\] you can import svn http://svn.nanorails.com/plugins/action\_mailer\_tls/ to your /vendor/plugins/ \[2\] edit your environment.rb by adding t...

Have a nice trying.  
Reinhart

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [October 1, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674/3 "2008-10-01T15:18:48Z")

</div>

I have the same problem. Did you find a solution?

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [October 1, 2008, 3:51pm UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674/4 "2008-10-01T15:51:42Z")

</div>

Just a blind guess.

Have you actually logged in with the account you’re sending the email  
from? If you didn’t please log in and complete the account creation  
process. If you did please login and ensure there’s no requirement to  
change your password in next login configured.

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [October 1, 2008, 6:59pm UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674/5 "2008-10-01T18:59:01Z")

</div>

Xavier N. wrote:

> Just a blind guess.
> 
> Have you actually logged in with the account you’re sending the email  
> from? If you didn’t please log in and complete the account creation  
> process. If you did please login and ensure there’s no requirement to  
> change your password in next login configured.

I hadn’t!!  
Well, I did it now and completed the account creation (I did’t have to  
change the password). But I still have the same error.

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [October 1, 2008, 10:21pm UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674/6 "2008-10-01T22:21:37Z")

</div>

On Wed, Oct 1, 2008 at 6:59 PM, Guilherme Schneider  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I hadn’t!!  
> Well, I did it now and completed the account creation (I did’t have to  
> change the password). But I still have the same error.

Well that’s a hint. I’d wait a bit in case the account was flagged as  
spam, o create a new one and complete the process before sending  
emails. In my case I got a quota problem with 40 emails or so due to  
that.

In my experience action\_mailer\_tls works out-of-the-box, so if it’s  
properly configured and the Google account itself is OK it should work  
just fine.

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [October 6, 2008, 10:14pm UTC](https://www.ruby-forum.com/t/action-mailer-tls-gmail/135674/7 "2008-10-06T22:14:02Z")

</div>

Done!!  
The problem was with the port 587 being blocked by the firewall.  
Thanks for your support!  
Guilherme
