Rails ActionMailer与Devise + Google Apps在开发模式下 [英] Rails ActionMailer w/ Devise + Google Apps in Development Mode

查看:90
本文介绍了Rails ActionMailer与Devise + Google Apps在开发模式下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用我的Google Apps帐户配置ActionMailer,以开发模式从Devise发送邮件。我已将以下内容添加到我的config / environments / development.rb文件中,但看起来邮件没有发送。注意:这是针对Google Apps而不是Gmail(但是Gmail服务器应该可以正常工作) - 他们在邮件客户端中执行。

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"
  }


推荐答案

使用我们的Google Apps帐户(和Devise)成功使用所有相同的设置 - 唯一的区别是我们使用plain作为:身份验证。

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.

差异 - 我们在生产环境中使用这种方式(我们发送电子邮件,但都是测试电子邮件地址而不是用户)。在开发中,我们只需查看rails日志来调试电子邮件...

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...

但有一件事您可能会检查:我正在使用已设置的macbook上的GMail进行测试使用MacPorts,但是使用rvm和Homebrew设置ruby / rails和其他东西,并在此环境中获取SSL异常 - 当我设置:enable_starttls_auto =>错误错误停止,但没有发送邮件。我认为MacPorts安装的库与Rails使用的库之间存在冲突。

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 :-)

这篇关于Rails ActionMailer与Devise + Google Apps在开发模式下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆