ruby on rails - send mail every 5 minutes using delayed job -


this question has answer here:

class testmailer < actionmailer::base def test_mail mail(:to => '(myemailaddress@removedforprivacy.com', :from =>   '(removedforprivacy)@gmail.com', :subject => 'testing delayed job',  :content_type => 'text/plain').deliver 

end handle_asynchronously :test_mail, :run_at => proc.new { 2.minutes.from_now }

end

i think want send email every 5 minutes using delayed_job cron task. can use delayed_cron_job gem accomplish purpose.

you can add: delayed_cron_job gemfile , run: bundle install. then, run:

rails generate delayed_job:cron bundle exec rake db:migrate 

then, can use this:

delayed::job.enqueue(delayedemailjob.new(@user.email), cron: '0,5,10,15,20,25,30,35,40,45,50,55 * * * *') 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -