我正在使用sidekiq在后台发送邮件。 我在sidekiq日志中得到这个
def performed?
create_activation_digest &&
customer.save &&
send_mail(:account_activation, { email: customer.email, activation_token: customer.activation_token }) # from here mailer method is being called
end
class ApplicationMailer < ActionMailer::Base
default from: 'lavo@cactimedia.biz'
layout 'mailer'
before_action :initialize_defaults
private
def initialize_defaults
@greeting = "Dear User,"
@signature = "The Lavo Team"
end
end
class NotificationsMailer < ApplicationMailer
def account_activation(args={})
activation_token = args[:activation_token]
email = args[:email]
@activation_link = edit_api_activation_url(activation_token, email: email)
mail(to: email)
end
end
[ActiveJob] [ActionMailer::DeliveryJob] [2797cd49-dabe-4af0-a5a8-c47ae5e956b3] Performing ActionMailer::DeliveryJob from Sidekiq(mailers) with arguments: "NotificationsMailer", "password_digest", "deliver_now", #<GlobalID:0x00000007281480 @uri=#<URI::GID gid://lavo-laundry/Customer/6>>
[ActiveJob] [ActionMailer::DeliveryJob] [2797cd49-dabe-4af0-a5a8-c47ae5e956b3] Performed ActionMailer::DeliveryJob from Sidekiq(mailers) in 0.97ms
但邮件没有发送。如果我错过了什么,有人知道吗?
答案 0 :(得分:2)
检查sidekiq设置是否包含以下内容:
# config / sidekiq.yml
---
:queues:
- mailers
或启动sidekiq服务:
bundle exec sidekiq -q default -q mailers
如https://github.com/mperham/sidekiq/wiki/Active-Job#action-mailer
所示