问题
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