使用Heroku上的resque未发送电子邮件

时间:2015-08-28 08:57:31

标签: ruby-on-rails email heroku resque rails-activejob

我发送电子邮件的延迟工作按照heroku日志排队并正确处理,但我从未收到过电子邮件。它在本地具有相同的smtp设置,因此我不知道问题是什么。

以下是日志摘录:

排队:

2015-08-28T08:46:46.935402+00:00 app[web.1]: [ActiveJob] Enqueued ActionMailer::DeliveryJob (Job ID: 9e9e8110-ee2f-4562-9a03-b1f482d56c7c) to Resque(mailers) at 2015-08-28 08:47:46 UTC with arguments: "UserMailer", "thank_you", "deliver_now!", "xxx@gmail.com"

处理:

    2015-08-28T08:47:50.912636+00:00 app[scheduler.1]: 2015-08-28 08:47:50 Processing Delayed Items
2015-08-28T08:47:54.637690+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [9e9e8110-ee2f-4562-9a03-b1f482d56c7c] Performing ActionMailer::DeliveryJob from Resque(mailers) with arguments: "UserMailer", "thank_you", "deliver_now!", "xxx@gmail.com"
2015-08-28T08:47:54.658354+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [9e9e8110-ee2f-4562-9a03-b1f482d56c7c]   Rendered user_mailer/thank_you.html.erb within layouts/mailer (2.7ms)
2015-08-28T08:47:55.294365+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [9e9e8110-ee2f-4562-9a03-b1f482d56c7c] Performed ActionMailer::DeliveryJob from Resque(mailers) in 656.38ms
2015-08-28T08:47:54.932032+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [9e9e8110-ee2f-4562-9a03-b1f482d56c7c]
2015-08-28T08:47:54.932073+00:00 app[worker.1]: UserMailer#thank_you: processed outbound mail in 290.2ms

production.rb和development.rb中的SMTP设置:

 config.action_mailer.delivery_method = :smtp


 # SMTP settings for gmail
  config.action_mailer.smtp_settings = {
   :address              => "smtp.gmail.com",
   :port                 => 587,
   :user_name            => ENV['gmail_username'],
   :password             => ENV['gmail_password'],
   :authentication       => "plain",
  :enable_starttls_auto => true
  }

1 个答案:

答案 0 :(得分:0)

终于找到了解决方案:

转到http://www.google.com/accounts/DisplayUnlockCaptcha并点击“继续”(这将为注册新应用授予10分钟的访问权限)。在此之后我的生产应用程序开始发送电子邮件;)