邮件发送不起作用

时间:2018-01-10 07:38:43

标签: ruby-on-rails devise actionmailer

在我的应用中为用户使用设备。在开发模式下,所有工作正常,但在生产中尝试时,我有问题。我的config/environments/production.rb

config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = {host: 'radiant-journey-52383.herokuapp.com'}
  config.action_mailer.smtp_settings = {
      user_name:      ENV['SENDMAIL_USERNAME'],
      password:       ENV['SENDMAIL_PASSWORD'],
      domain:         ENV['PROD_MAIL_HOST'],
      address:       'smtp.gmail.com',
      port:          '587',
      authentication: :plain,
      enable_starttls_auto: true
  }

我做错了什么?

1 个答案:

答案 0 :(得分:0)

Please use domain: 'gmail.com'
use port number with url
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = {host: 'radiant-journey-52383.herokuapp.com', port: 3000}
config.action_mailer.smtp_settings = {
      user_name:      ENV['SENDMAIL_USERNAME'],
      password:       ENV['SENDMAIL_PASSWORD'],
      domain:         'gmail.com',
      address:       'smtp.gmail.com',
      port:          '587',
      authentication: :plain,
      enable_starttls_auto: true
}