Resend Devise Confirmation Emails For Incomplete Accounts
Share
It’s slightly frustrating looking through your users table and seeing a bunch of accounts that signed up but never confirmed, only existing in this limbo land where you can’t quite count them as a conversion and they seem to have dropped off the face of the earth.
This rake task will look through your users table for unconfirmed devise accounts and one by one resend their confirmation emails.
You can schedule this to run once a day and attempt to reclaim lost users. Here’s how
Create a file named “user.rake” in your Rails project under lib/tasks
Paste the following in
namespace :user do task :resend_confirmation => :environment do users = User.where('confirmation_token IS NOT NULL') users.each do |user| user.send_confirmation_instructions end end end
Now from the terminal, from within your Rails app path, simply run
rake user:resend_confirmation
or if you’re a Heroku user
heroku run rake user:resend_confirmation
Heroku offers a free scheduler which you can use to schedule the emails to be resent daily. Simply use addon found here: https://addons.heroku.com/scheduler