Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't send Devise's confirmation_email #23

Open
Frexuz opened this issue Oct 19, 2016 · 2 comments
Open

Can't send Devise's confirmation_email #23

Frexuz opened this issue Oct 19, 2016 · 2 comments

Comments

@Frexuz
Copy link

Frexuz commented Oct 19, 2016

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'
@awais545
Copy link

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.

@wa0x6e
Copy link

wa0x6e commented Jan 23, 2017

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants