简体   繁体   English

Devise确认电子邮件未与Sidekiq,Redis和ActiveJob一起作为后台作业发送

[英]Devise Confirmation emails not sending as background job with Sidekiq, Redis and ActiveJob

I have set up Devise Confirmable on my Rails app and have it all working fine, however when trying to set Devise emails to run in the background no emails are sent. 我已经在Rails应用程序上设置了Devise Confirmable,并且一切正常,但是,当尝试将Devise电子邮件设置为在后台运行时,不会发送任何电子邮件。

gem 'devise', '~> 4.3'
gem 'devise_invitable', '~> 1.7', '>= 1.7.2'
gem "sidekiq"

1) I have Redis and Sidekiq set up and running locally (they worked on a non devise welcome email). 1)我已经在本地设置和运行Redis和Sidekiq(他们处理非设计欢迎电子邮件)。

2) I've added this into my User.rb model (devise docs - https://github.com/plataformatec/devise#activejob-integration ) 2)我已将其添加到我的User.rb模型中(设计文档-https: //github.com/plataformatec/devise#activejob-integration

def send_devise_notification(notification, *args)
  UserMailer.send(notification, self, *args).deliver_later
end

In the log it seems to trigger the Job but then nothing is sent. 在日志中,似乎触发了作业,但是什么也没发送。

[ActiveJob] Enqueued ActionMailer::DeliveryJob (Job ID: 01f432e9-e8cf-47fa-
b5ac-de936aa920d1) to Sidekiq(mailers) with arguments: "UserMailer", 
"confirmation_instructions", "deliver_now", #<GlobalID:0x007f86f539e198 @uri=#
<URI::GID gid://experiment-log-v1/User/78>>, "wYfrsX13ie5fAFWKV8tp", {}

I've also tried adding "mailers" to the sidekiq.yml 我还尝试过在sidekiq.yml中添加“邮件程序”

:queues:
 - default
 - mailers

Am I missing something in ActiveJob for this? 我为此在ActiveJob中缺少什么吗? If so what would I put in order to override all Devise emails? 如果是这样,我将如何处理以覆盖所有Devise电子邮件?

Silly mistake - I didn't realise but I'd added the send_devise_notification method below "private" in my User model. 愚蠢的错误-我没有意识到,但是在我的用户模型中的“私有”下面添加了send_devise_notification方法。 After moving it above it all worked fine. 将其移至上方后,一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM