【问题标题】:Does ActionMailer :sendmail work in production?ActionMailer :sendmail 在生产中工作吗?
【发布时间】:2014-01-19 10:14:50
【问题描述】:

我有一个 Rails 4 应用程序,我正在尝试在 heroku 上部署到生产环境。我正在使用 ActionMailer :sendmail 从应用程序发送电子邮件。 :sendmail 在开发中工作正常,但该应用程序似乎没有在生产中发送电子邮件。 config/environments/development.rb 的配置是

Controlsafe::Application.configure do
  ........ 
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = {host: 'localhost:3000'}
  config.action_mailer.default_options = {from: 'no-reply@controlsafe.com'}
  config.action_mailer.delivery_method = :sendmail
  .......
end

对于 config/environments/production.rb 是

Controlsafe::Application.configure do
  ........ 
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = {host: 'controlsafe.com'}
  config.action_mailer.default_options = {from: 'no-reply@controlsafe.com'}
  config.action_mailer.delivery_method = :sendmail
  .......
end

我不确定为什么应用程序在生产中运行良好时没有发送电子邮件。 :sendmail 甚至可以在生产中使用吗?还是我必须使用 SMTP?

如果有人能提供一些见解,那就太棒了!

谢谢!

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4


    【解决方案1】:

    根据 Heroku,您需要使用外部 SMTP 服务

    https://devcenter.heroku.com/articles/smtp

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-19
      • 2012-02-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多