I want to resend an activation email to users if they do not activate it in 48 hours. I used whenever gem but it is not sending the email. even if action mailer works fine and sends an email when a user signs up schedule.rb
set :environment, :development
every 1.minutes do
runner "user.resend_account_activation"
end
user_mailer.rb
def resend_account_activation
@user = User.where('activated = ?',false && 'activated_at < ?',48.hours.ago)
mail to: @user.email, subject: "You forgot to activate"
end
user.rb
def resend_account_activation
# @outdated_users = User.where('activated_at < ?',30.seconds.ago)
UserMailer.resend_account_activation.deliver_now!
end
In my cmd
# Begin Whenever generated tasks for: store
* * * * * /bin/bash -l -c 'cd /mnt/c/Sites/testApp && bin/rails runner -e production '\''user.resend_account_activation'\'''
# End Whenever generated tasks for: store