What is the best way to schedule a sending-email task with Ruby on Rails?

后端 未结 5 742
生来不讨喜
生来不讨喜 2020-12-28 09:53

I would like to schedule a daily task : every day at 7 AM, I want an email to be sent (without human intervention).

I\'m working on the RoR framework and I\'m wonder

5条回答
  •  悲&欢浪女
    2020-12-28 10:51

    I was impressed by (and plan to try) the rufus-scheduler gem discussed in this blog post

    He describes something like this:

    scheduler = Rufus::Scheduler.start_new  
    
    scheduler.every("1m") do  
       DailyDigest.send_digest!  
    end 
    

    ..which seems pretty simple. I wonder how easy it would be to add HTML-based configuration?

提交回复
热议问题