在Rails 4 Devise注册过程中完成500内部服务器错误

时间:2014-03-24 15:56:07

标签: ruby-on-rails devise actionmailer

当我在网站上注册一个新用户时,我填写表单,点击提交,然后它在那里停留几秒钟,然后发送'我们很抱歉,但出了点问题。 '

日志低于......

https://gist.github.com/th3cuda/225f1352a7cfeee3f8f8

这部署在digitalocean上。

production.rb

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

config.action_mailer.default_url_options = { :host => 'MY_HOST' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => 'smtp.MY_DOMAIN.com',
  :port                 => 465,
  :domain               => 'MY_DOMAIN',
  :user_name            => 'MY_EMAIL',
  :password             => 'PASSWORD',
  :authentication       => 'plain',
  :enable_starttls_auto => true
}
end

2 个答案:

答案 0 :(得分:0)

由于它花了一段时间,它可能正在寻找sendmail(它默认使用/ usr / sbin / sendmail)来发送电子邮件。

我会确保它已经到位,应用程序可以使用它,并且config /(Dev,Prod等)允许它发送电子邮件。

这有什么用吗?让我知道你发现了什么,这样我就可以给出更好的答案。

答案 1 :(得分:0)

很抱歉再添加一个答案,但格式化很重要。

config.action_mailer.default_url_options = { :host => 'MY_HOST' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => 'smtpout.secureserver.net',
  :port                 => 80,
  :domain               => 'www.example.com',
  :user_name            => 'johndoe@example.com',
  :password             => 'yourpassword',
  :authentication       => 'plain'
}
end

注意我删除了starttls选项,并将port设置为80.显然,请替换为您的实际值。如果您正在使用常量,请避免使用这些常量,直到此问题得到解决。