Rails 4.2.1动作邮件程序没有发送电子邮件

时间:2015-06-08 13:45:51

标签: ruby-on-rails ruby email sendmail actionmailer

Actionmailer似乎没有发送我的电子邮件,我的应用程序在生产环境中。我的config / environments / production.rb

中有以下设置
  config.action_mailer.delivery_method = :sendmail
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_options = {from: 'noreply@domain.com'}
  config.action_mailer.default_url_options = { host: 'http://domain.com' }

发送邮件

UserMailer.welcome(self).deliver_now

Rails版本:4.2.1

在我的production.log中没有显示任何错误,所有任务都已完成,并在日志中显示实际的邮件输出。

感谢名单!

1 个答案:

答案 0 :(得分:1)

试试这个

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
     :address => "smtp.gmail.com",
     :port => 587,
     :user_name => "your mail",
     :password => "your password",
     :authentication => :plain,
     :enable_starttls_auto => true
}