Rails ActionMailer w/ Devise +开发模式下的 Google Apps
我正在尝试将 ActionMailer 配置为使用我的 Google Apps 帐户在开发模式下从 Devise 发送邮件。我已将以下内容添加到我的 config/environments/development.rb 文件中,但看起来邮件未发送。注意:这是针对 Google Apps,而不是 Gmail(但 Gmail 服务器应该可以工作——它们在我的邮件客户端中可以工作)。
我的配置中有什么奇怪的地方吗?
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 => "[email protected]",
:password => "mypass"
}
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 => "[email protected]",
:password => "mypass"
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们在 Google Apps 帐户(和 Devise)中成功使用了所有相同的设置 - 唯一的区别是我们使用“plain”进行 :authentication。
略有不同——我们在生产环境和临时环境中使用它(我们发送电子邮件,但全部发送到测试电子邮件地址而不是用户)。在开发过程中,我们只是查看 Rails 日志来调试电子邮件...
但是您可能会检查一件事:我正在使用 MacPorts 设置的 MacBook 上使用 GMail 进行测试,但使用 ruby/rails 和使用 rvm 设置的其他内容和 Homebrew 并在此环境中遇到 SSL 异常 - 当我设置
:enable_starttls_auto =>; false
错误已停止,但没有发送邮件。我认为 MacPorts 安装的库和 Rails 使用的库之间存在冲突。不确定这是否有帮助:-)
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 :-)