I need to send some emails weekly. I installed the mailer and did several tests. Is working properly.
But I can not use Whenever to automatically send emails. Have searched in various forums and still can not fix.
Model/HrCurriculumIntern
def self.send_reply_interns
@users = HrCurriculumIntern.where(:answer_sent => t('labels.n'))
InternMailer.send_reply_interns(@users).deliver
end
Mailer/InternMailer
default :from => "[email protected]"
def send_reply_interns(users)
@users = users
mail(:to => "<[email protected]>", :subject => t('subjects.send_reply_interns'), :from => "[email protected]")
end
COnfig/schedule.rb
set :environment, :development
every 2.minutes do
runner "HrCurriculumInterns.send_reply_interns"
end
I followed this steps: Eu segui estes passos:
wheneverize .
whenever
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c 'cd /var/www/form/3216/email/trunk && script/rails runner -e development '\''HrCurriculumInterns.send_reply_interns'\'''
## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.
whenever –update-crontab
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /bin/bash -l -c 'cd /var/www/form/3216/email/trunk && script/rails runner -e development '\''HrCurriculumInterns.send_reply_interns'\'''
## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.
I can't see the problem, any suggestion please?
Use the shortcut "whenever -w" to write the crontab. It looks like you used "whenever -update-crontab" instead of "whenever --update-crontab". So neither of your commands actually wrote the crontab file. The response should be
[write] crontab file updated
After that use "crontab -l" to verify that the correct cron was written.