Send password reset emails in bulk?

Just rectifying here - that script does work. I just had to:

cd /var/discourse
sudo ./launcher enter app

Then create the file:

// create file
touch password.rb

Then add the following code:

email_token = nil

User.all.each do |u|
  email_token = u.email_tokens.create(email: u.email)
  Jobs.enqueue(:critical_user_email, type: :forgot_password, user_id: u.id, email_token: email_token.token)
  sleep(5)
end

And finally, run it:

rails r password.rb

It did work for me :slight_smile:.

2 Likes