views:

543

answers:

2

Hi,

I have installed restful_authentcation from technoweenie with activation, and so I see the generated UserMailer < ActionMailer::Base.

However, the instructions don't include how to set it up to work with Google SMTP.

I am guessing that environments/development.rb needs to have the SMTP settings, but still not sure given Google (via Google apps) are all TLS.

Anyone set up activation using restful_authentication?

I currently put into environments.rb the following:

 ActionMailer::Base.smtp_settings = {
     :enable_starttls_auto => true,
     :address => "smtp.gmail.com",
     :port => "587",
     :domain => "mydomain.com",
     :authentication => :plain,
     :user_name => "[email protected]",
     :password => "mypassword"

}

Thanks!!

A: 

I've never used SMTP from ruby (I have from python), but that looks right. You have the right domain and port (actually, multiple ports are supported, but that's one of them), and you're using starttls and AUTH PLAIN, which Google does use.

Matthew Flaschen
sight, it's not working:530 5.7.0 Must issue a STARTTLS command first. l31sm1276848rvb.39
Angela
Yeah. I don't know why your ruby lib isn't doing that for you, though.
Matthew Flaschen
A: 

As far as I know, ActionMailer doesn't do TLS out of the box (2.3.2). A couple of months ago I had the same issue and found some code on a Japanese page and integrated that. it appears that code has been wrapped up into a plugin now (with english docs yeah!). That's not exactly what I'm using, but it advertises the same effect.

so add this plugin: http://github.com/openrain/action_mailer_tls/tree/master

and in environments/development.rb or environements.rb you need something like this:

ActionMailer::Base.smtp_settings = {
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "yourdomain.com",
  :user_name => "[email protected]",
  :password => "passwd",
  :authentication => :plain
}

I see that :enable_starttls_auto => true is now in the docs, but it wasn't when I started. this at least works for me...

Edit: for some reason that link doesn't work if you follow it, but copy paste in the address bar and it's live...