How to manually send a Devise email?

devise, email, ruby, ruby-on-rails

Solution

Here’s where the `ConfirmationsController` sends the email:

self.resource = resource_class.send_confirmation_instructions(resource_params)

Have you tried this?

u.send_confirmation_instructions

EDIT to add `Devise::Mailer`-based method:

u.send(:generate_confirmation_token)
Devise::Mailer.confirmation_instructions(u, u.instance_variable_get(:@raw_confirmation_token))

Problem

I want to manually send a Devise confirmation email to a user of my app. Like this: ``` u = User.last Devise::Mailer.confirmation_instructions u ``` but Devise's `confirmation_instructions` takes three parameters, the second being a token (according to the documentation) and the third being a Hash. How do I get it in order to be able to send these emails?

Original source