【问题标题】:Rails ActionMailer w/ Devise + Google Apps in Development ModeRails ActionMailer w/ Devise + Google Apps 处于开发模式
【发布时间】:2011-08-13 04:36:57
【问题描述】:

我正在尝试将 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 => "myemaiL@mydomain.com",
    :password => "mypass"
  }

【问题讨论】:

  • 你设置了 config.action_mailer.raise_delivery_errors = true 吗?

标签: ruby-on-rails smtp devise actionmailer google-apps


【解决方案1】:

我们在 Google Apps 帐户(和 Devise)上成功使用了所有相同的设置——唯一的区别是我们使用“普通”进行 :authentication。

略有不同——我们在生产环境中使用它,在我们的暂存环境中使用它(我们在那里发送电子邮件,但全部发送到测试电子邮件地址而不是用户)。在开发过程中,我们只需要查看 rails 日志来调试电子邮件......

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

不确定这是否有帮助:-)

【讨论】:

    猜你喜欢
    • 2010-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-17
    • 1970-01-01
    • 2014-01-13
    • 1970-01-01
    相关资源
    最近更新 更多