Sology / maily_herald

Advanced email processing solution for Ruby on Rails applications

Home Page:http://mailyherald.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't send Devise's confirmation_email

Frexuz opened this issue · comments

Error:

NoMethodError: protected method `process' called for #UserMailer:0x0055f87edc6af0

Note that everything works fine without config.parent_mailer = 'MailyHerald::Mailer' in Devise's config.

Code

User model is skipping the normal devise confirmation email

class User < ApplicationRecord
  before_create :skip_confirmation_email
  after_create :send_confirmation_email

  def send_confirmation_email
    delay.send_confirmation_instructions # have also tried without `delay`
  end

  def skip_confirmation_email
    skip_confirmation_notification!
  end
end

Devise mailer config (from your wiki)

Devise.setup do |config|
  # Configure the class responsible to send e-mails.
  config.mailer = 'UserMailer'
  config.parent_mailer = 'MailyHerald::Mailer'
end

MailyHerald setup

MailyHerald.setup do |config|
  config.ad_hoc_mailing :confirmation_instructions do |mailing|
    mailing.title = 'Confirmation Instructions'
    mailing.list = :all_users
    mailing.mailer_name = 'UserMailer'
    mailing.enable
  end
end

And the UserMailer

class UserMailer < Devise::Mailer
  helper :application # gives access to all helpers defined within `application_helper`.
  include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
  default from: '"example.net" <mailer@example.net>', template_path: 'devise/mailer' # to make sure that mailer uses the devise views

  def confirmation_instructions(record, opts = {})
    @token = record.confirmation_token
    devise_mail(record, :confirmation_instructions, opts)
  end
end

Full stacktrace:

NoMethodError: protected method `process' called for #<UserMailer:0x0055f87edc6af0>
Did you mean?  proc
  from action_mailer/message_delivery.rb:105:in `block in processed_mailer'
  from action_mailer/message_delivery.rb:104:in `tap'
  from action_mailer/message_delivery.rb:104:in `processed_mailer'
  from action_mailer/message_delivery.rb:95:in `deliver_now'
  from sidekiq/extensions/action_mailer.rb:33:in `deliver'
  from sidekiq/extensions/action_mailer.rb:22:in `perform'
  from sidekiq/processor.rb:152:in `execute_job'
  from sidekiq/processor.rb:134:in `block (2 levels) in process'
  from sidekiq/middleware/chain.rb:128:in `block in invoke'
  from sidekiq/middleware/server/active_record.rb:6:in `call'
  from sidekiq/middleware/chain.rb:130:in `block in invoke'
  from sidekiq/middleware/server/retry_jobs.rb:74:in `call'
  from sidekiq/middleware/chain.rb:130:in `block in invoke'
  from sidekiq/middleware/server/logging.rb:11:in `block in call'
  from sidekiq/logging.rb:32:in `with_context'
  from sidekiq/middleware/server/logging.rb:7:in `call'
  from sidekiq/middleware/chain.rb:130:in `block in invoke'
  from sidekiq/middleware/chain.rb:133:in `invoke'
  from sidekiq/processor.rb:129:in `block in process'
  from sidekiq/processor.rb:168:in `stats'
  from sidekiq/processor.rb:128:in `process'
  from sidekiq/processor.rb:80:in `process_one'
  from sidekiq/processor.rb:68:in `run'
  from sidekiq/util.rb:17:in `watchdog'
  from sidekiq/util.rb:25:in `block in safe_thread'

I am facing the exact same issue. It would be great to get this fixed asap as this is the only issue that is preventing us from launch.

commented

+1