Sidekiq在开发中不发送电子邮件

Sidekiq在开发中不发送电子邮件

本文介绍了Rails 4.2-Sidekiq在开发中不发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rails应用程序,其中有一种发送大量电子邮件的方法。我想异步地执行此操作。为此,我尝试使用 Sidekiq ,但是我无法使其正常工作-它不发送任何电子邮件。



以前发送电子邮件有效,所以我确定我的电子邮件设置正确。



在我的 gemfile 中,我有以下内容:

  gem'sidekiq'

我已经运行了捆绑安装。我还安装了 redis ,并按照。


I have a rails app in which I have a method where I send a lot of emails. I would like to perform this action asynchronously. To do it I've tried to use Sidekiq, but I can't get it to work properly - it doesn't send any emails.

Sending email worked before, so I'm certain that my email settings is set ut correctly.

In my gemfile I have this:

gem 'sidekiq'

And I have run bundle install. I have also install redis, followed the instructions on RailsCasts #366.

I have started sidekiq with the following command: bundle exec sidekiq, this resulted in what can be seen in the image below:

In application.rb I have the following:

config.active_job.queue_adapter = :sidekiq

And I try to send the emails like this:

Mailer.deliver_new_competition_notification(member.user,   @competition).deliver_later!

I don't get any errors, but the emails never gets sent.

So, have I missed something?

解决方案

You need to bootup sidekiq with the mailer queue for it to pick up these jobs:

bundle exec sidekiq -q default -q mailers

The Sidekiq Wiki goes over the scenarios in detail here.

这篇关于Rails 4.2-Sidekiq在开发中不发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 23:06