Question

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 => "xxx@mydomain.com",
     :password => "mypassword"

}

Thanks!!

Was it helpful?

Solution

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 => "first.last@gmail.com",
  :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...

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top