palash-kulkarni
palash-kulkarni

Reputation: 407

Sidekiq is not sending email

I am using sidekiq for sending mails in background. And i am getting this in sidekiq log

  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: '[email protected]'
  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

But mail are not being sent. Does somebody have any idea if i am missing something?

Upvotes: 1

Views: 2483

Answers (1)

jonathanccalixto
jonathanccalixto

Reputation: 3208

Checks if the sidekiq settings have the following:

# config / sidekiq.yml
---
:queues:
  - mailers

or starts the sidekiq service with:

bundle exec sidekiq -q default -q mailers

as demonstrated at https://github.com/mperham/sidekiq/wiki/Active-Job#action-mailer

Upvotes: 3

Related Questions