【问题标题】:Rails 4.2.1 Action mailer not delivering the emailsRails 4.2.1 Action mailer 不发送电子邮件
【发布时间】:2015-08-23 00:27:11
【问题描述】:

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 中没有显示任何错误,所有任务都已完成,并且在日志中显示了实际的邮件输出。

谢谢!

【问题讨论】:

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


    【解决方案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
    }
    

    【讨论】:

    • 这确实有效,从技术上讲不是我想要的解决方案,因为我想使用 sendmail 而不是 smtp,但这仍然是正确的,并且引导我也解决了我自己的问题,所以谢谢! :)
    猜你喜欢
    • 2013-05-21
    • 1970-01-01
    • 1970-01-01
    • 2015-09-08
    • 2011-05-15
    • 2011-07-14
    • 2012-07-25
    • 2021-01-22
    • 2013-04-14
    相关资源
    最近更新 更多