title: What's the most elegant way to implement a digest email without reinventing a queueing system?
body: <p>I have my transactional email system setup &amp; by default people get emails as events happen:</p>
  
  <pre><code>class Comment
  
    after_create :email_original_poster
  
    def email_original_poster
      UserMailer.delay.notify_author_of_comment self
    end
  
  end
  </code></pre>
  
  <p>However instead of getting the email as-it-happens, a chunk of my users would prefer a daily or weekly digest. </p>
  
  <p><strong>What's the cleanest most elegant way to implement this?</strong></p>
  
  <p>I've already got <code>delayed_job</code> running but this doesn't really feel like a <code>delayed_job</code> job since I'm queueing data that needs to be acted on rather than actions that need to be executed.</p>
  
  <p><strong>...without reinventing a queueing system</strong></p>
  
  <p>I know that the obvious solution is table of <code>queued_emails</code> and of course I could do that. The reason I'm asking the question is that to do so is reinventing a queueing system. Not only are there lots of queuing systems out there but as this well worded post from Percona points out, it's a good idea not to roll your own:</p>
  
  <p><a href="http://www.engineyard.com/blog/2011/5-subtle-ways-youre-using-mysql-as-a-queue-and-why-itll-bite-you/">http://www.engineyard.com/blog/2011/5-subtle-ways-youre-using-mysql-as-a-queue-and-why-itll-bite-you/</a></p>
  
  <p><em>Have you implemented a digest email, did you use <code>delayed_job</code> &amp; what did you learn?</em></p>