Rails ActionMailer w/ Devise + Google Apps in Development Mode

ぃ、小莉子 提交于 2019-12-22 08:11:46

问题


I'm trying to configure ActionMailer to send mail from Devise in development mode with my Google Apps account. I've added the following to my config/environments/development.rb file, but it looks like mail is not being sent. Note: this is for Google Apps, not Gmail (but the Gmail servers should work -- they do in my mail client).

Anything jump out as strange in my config?

config.action_mailer.delivery_method = :smtp

  config.action_mailer.smtp_settings = {
    :enable_starttls_auto => true,
    :address => "smtp.gmail.com",
    :port => 587,
    :domain => "mydomain.com",
    :authentication => :login,
    :user_name => "myemaiL@mydomain.com",
    :password => "mypass"
  }

回答1:


We're using all the same settings successfully with our Google Apps account (and Devise) -- the only difference is that we're using "plain" for :authentication.

A slight difference -- we're using this in production and sort of on our staging environment (there we send email, but all to a test email address rather than to users). On development we just look in the rails log to debug emails...

But one thing you might check: I was testing using GMail on a macbook that had been set up with MacPorts, but with ruby/rails and other stuff set up using rvm and Homebrew and was getting SSL exceptions in this environment -- when I set :enable_starttls_auto => false the error stopped, but no mail was sent. I think there was a conflict between the libraries installed by MacPorts and the ones used by Rails.

Not sure if that helps :-)



来源:https://stackoverflow.com/questions/5793296/rails-actionmailer-w-devise-google-apps-in-development-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!