# Ruby 1.8.7 + Rails 2.3.2 + TLS = Where's the documentation?

**URL:** <https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389>\
**Category:** Rails\
**Created:** [April 13, 2009, 4:01pm UTC](https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389 "2009-04-13T16:01:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmht81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dmht81](https://www.ruby-forum.com/u/dmht81)\
**Post date:** [April 13, 2009, 4:01pm UTC](https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389/1 "2009-04-13T16:01:47Z")

</div>

After spending a few hours reading dozens of blogs and tutorials I am  
still stumped. Numerous sites mention ruby 1.8.7 and rails 2.3  
supporting TLS out of the box. However, I can not find any documentation  
on setting this up to send emails correctly. Furthermore, after  
attempting to send emails using Gmail and TLS i get the following error:

530 5.7.0 Must issue a STARTTLS command first. i6sm501424tid.20

/usr/local/lib/ruby/1.8/net/smtp.rb:942:in `check_auth_response' /usr/local/lib/ruby/1.8/net/smtp.rb:733:in `auth\_plain’  
/usr/local/lib/ruby/1.8/net/smtp.rb:725:in `send' /usr/local/lib/ruby/1.8/net/smtp.rb:725:in `authenticate’  
/usr/local/lib/ruby/1.8/net/smtp.rb:566:in `do_start' /usr/local/lib/ruby/1.8/net/smtp.rb:525:in `start’

Can anyone point me in the right direction?!

Thanks in advance!

I have the following configuration in my  
config/environments/development.rb:

# Don’t care if the mailer can’t send

config.action\_mailer.raise\_delivery\_errors = true

# set delivery method to :smtp, :sendmail or :test

config.action\_mailer.delivery\_method = :smtp

# these options are only needed if you choose smtp delivery

config.action\_mailer.smtp\_settings = {  
:address =\> ‘[smtp.gmail.com](http://smtp.gmail.com)’,  
:enable\_starttls\_auto =\> true,  
:port =\> 587,  
:domain =\> ‘…’,  
:authentication =\> :login,  
:user\_name =\> ‘…’,  
:password =\> ‘secret’  
}

---

<div class="post-metadata">

**Author:** ![dmht81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dmht81](https://www.ruby-forum.com/u/dmht81)\
**Post date:** [April 13, 2009, 10:11pm UTC](https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389/2 "2009-04-13T22:11:13Z")

</div>

Looks like you have a :user\_name misspecified, this is meant to be the  
gmail user account that will be used to send the email and must be a  
valid gmail account.

Here’s what I use as: config/initializers/action\_mailer.rb:

ActionMailer::Base.delivery\_method = :smtp

ActionMailer::Base.smtp\_settings = {  
:enable\_starttls\_auto =\> true,  
:address =\> “[smtp.gmail.com](http://smtp.gmail.com)”,  
:port =\> “587”,  
:domain =\> “engine.local”,  
:authentication =\> :plain,  
:user\_name =\> “bultaco.rick”,  
:password =\> “\*\*\*\*\*\*\*\*\*\*\*\*\*”  
}

I’ve tried your method - config… in config/environments/  
development.rb works as well.

ActionMailer::Base in actionmailer-2.3.2/rdoc has a section on  
configuration options.  
On Apr 13, 4:01 am, obiwan chinobi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![dmht81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dmht81](https://www.ruby-forum.com/u/dmht81)\
**Post date:** [April 13, 2009, 11:10pm UTC](https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389/3 "2009-04-13T23:10:25Z")

</div>

Rick wrote:

> Looks like you have a :user\_name misspecified, this is meant to be the  
> gmail user account that will be used to send the email and must be a  
> valid gmail account.

Very strange… Now I am getting the error:  
Net::SMTPAuthenticationError (535-5.7.1 Username and Password not  
accepted

I have tried changing the value of :user\_name to ‘info’ as well, same  
error…

---

<div class="post-metadata">

**Author:** ![dmht81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dmht81](https://www.ruby-forum.com/u/dmht81)\
**Post date:** [April 14, 2009, 3:25am UTC](https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389/4 "2009-04-14T03:25:28Z")

</div>

I’m not sure what you mean by “changing the value of :user\_name to  
‘info’…” but here’s the deal.

Whatever you use as the value associated with :user\_name I should be  
able to sent it mail at gmail. For instance, if you say…

:user\_name =\> “monkeylips”

I should be able to send an email (with attached banana) to  
removed\_email\_address@domain.invalid

Got it?

On Apr 13, 11:10 am, obiwan chinobi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![dmht81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dmht81](https://www.ruby-forum.com/u/dmht81)\
**Post date:** [April 14, 2009, 3:25am UTC](https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389/5 "2009-04-14T03:25:26Z")

</div>

I’m not sure what you mean by “changing the value of :user\_name to  
‘info’…” but here’s the deal.

Whatever you use as the value associated with :user\_name I should be  
able to sent it mail at gmail. For instance, if you say…

:user\_name =\> “monkeylips”

I should be able to send an email (with attached banana) to  
removed\_email\_address@domain.invalid

Got it?

On Apr 13, 11:10 am, obiwan chinobi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![dmht81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dmht81](https://www.ruby-forum.com/u/dmht81)\
**Post date:** [April 14, 2009, 4:25pm UTC](https://www.ruby-forum.com/t/ruby-1-8-7-rails-2-3-2-tls-wheres-the-documentation/165389/6 "2009-04-14T16:25:54Z")

</div>

> # these options are only needed if you choose smtp delivery
> 
> config.action\_mailer.smtp\_settings = {  
> :address =\> ‘[smtp.gmail.com](http://smtp.gmail.com)’,  
> :enable\_starttls\_auto =\> true,  
> :port =\> 587,  
> :domain =\> ‘…’,  
> :authentication =\> :login,  
> :user\_name =\> ‘…’,  
> :password =\> ‘secret’  
> }

Correct configuration to get this working is:  
config.action\_mailer.smtp\_settings = {  
:enable\_starttls\_auto =\> true,  
:address =\> ‘[smtp.gmail.com](http://smtp.gmail.com)’,  
:port =\> 587,  
:domain =\> ‘[your.domain.com](http://your.domain.com)’,  
:authentication =\> :plain,  
:user\_name =\> ‘removed\_email\_address@domain.invalid’,  
:password =\> ‘password’  
}
