What's the most elegant way to implement a digest email without reinventing a queueing system?

前端 未结 3 682
不知归路
不知归路 2021-02-06 11:24

I have my transactional email system setup & by default people get emails as events happen:

class Comment

  after_create :email_original_poster

  def email         


        
3条回答
  •  后悔当初
    2021-02-06 12:19

    Obviously you shouldn't have to create your own queueing system. I haven't used delayed_job, but I have used resque in conjunction with a nice little gem called resque_mailer that should do exactly what you want. What's nice about resque_mailer is that, once it's set up, you don't have to change how you'd normally send mail: MyMailer.some_mailing({vars}).deliver If for some reason you want to not use the queue to send the mail (send it right away), you just need to add ! after deliver and it'll do just that.

    Look into resque (with redis) and resque_mailer, I think it'll do what you want.

提交回复
热议问题